Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question 2D Sprite elements and Scroll View.

Discussion in 'UGUI & TextMesh Pro' started by Jamryl, Mar 20, 2022.

  1. Jamryl

    Jamryl

    Joined:
    Mar 9, 2020
    Posts:
    25
    Hi there!

    I'm creating a game where you can recruit "staff" randomly generated. The "staff" visual is created from a prefab made of several sprite renderers with a sprite library and a sprite resolver. The visual is bounded within a Sprite Mask and is inside an UI element looking like an ID card, containing text and images.

    The "ID card" is then instanced creating clones.

    I created a Scroll Rect with a Rect Mask to hide all UI elements outside the Scroll Rect but the sprites are still visible outside the Scroll Rect and I cannot hide them. Mask and Rect Mask don't mask sprites and setting up a Sprite Mask as a parent doesn't seem to work.

    I tried Sorting Groups but I could not make it work.

    Is anyone having a solution? I cannot change the sprites to image because they are randomly generated.
     
  2. streeetwalker

    streeetwalker

    Joined:
    Jun 4, 2013
    Posts:
    331
    It should work fine. you are adding your prefabs as children of the content element that is at the bottom of the hierarchy when you create a new Scroll View, right?
     
  3. Jamryl

    Jamryl

    Joined:
    Mar 9, 2020
    Posts:
    25
    I fixed the problem with an asset from unity store. Thanks for answering.
     
  4. NicoleStar

    NicoleStar

    Joined:
    Apr 13, 2020
    Posts:
    1
    Hi, may I know the name of the asset that you have found?