Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

RectMask2D and ScrollView not updating hidden elements?

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by LightStriker, Aug 8, 2019.

  1. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,471
    So here's the view of a panel in the editor, when we got at the bottom of a list:



    And here's the same one in a Windows build:



    We tried on both Unity 2018.4 and 2019.1.
    We didn't have this issue when previously this UI was rendered as a separated camera. We switched to Screen Overlay - for a boost in performance.

    Since it happens only in a build, I'm a bit lost on how to debug it.
     
  2. Trivium_Dev

    Trivium_Dev

    Joined:
    Aug 1, 2017
    Posts:
    49
    Can you post a picture with the hierarchy of your scroll-view and the inspector for each of the GameObjects in the hierarchy, to get a better idea of how you have everything setup and what components you are using?
     
  3. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,471


    Canvas - Screen Overlay
    ContextHandler - Vertical Layout Group (For Split Screen UI)
    Canvas - Inherit
    Prompt - Empty GameObject
    SystemView - The instanced view panel, a Canvas Inheriting
    ...
    ...
    JoystickBindings - ScrollRect
    Viewport - Rect Mask 2D
    Content - The Rect moved by ScrollRect
    ...
     
  4. Trivium_Dev

    Trivium_Dev

    Joined:
    Aug 1, 2017
    Posts:
    49
    Yeah I don't see anything that would explain the missing items. I assume you are scrolling down and that there are more items above "Offhand", so for some reason those bottom items are missing. Might be worth putting a debug script that prints something to the console that says whether a "RemappableInputSlot" is active and where it's at and some other information, and then do a development build so that you can see the console in the build itself.

    My hunch is that for some reason those remappable input slots aren't being created, or the gameobjects are inactive so they are invisible.

    Might also want to try using a regular Mask component and see if it works with that, might be an issue with the RectMask2D - I generally use the Mask one but I realize the RectMask2D has some performance improvements.
     
  5. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,471
    Yup, this is the bottom of the list. The invisible items are those that were "off" the first page.

    It all works in the editor. What would be different in a build?
     
  6. Trivium_Dev

    Trivium_Dev

    Joined:
    Aug 1, 2017
    Posts:
    49
    It's hard to say. Sometimes shaders work differently in the Editor than they do in a build. Some settings in the Project Settings (API Compatibility level for example) can behave differently or cause things to not work as they do in the Editor.

    I did put together a very simple ScrollView to make sure the RectMask2D would work as expected and it does. Only other thing I can think of is you try a new scene and try to simplify it a bit just to see if you can get it to work and then maybe why it's happening will become apparent - for example instead of creating everything at runtime just setup the scene with everything already in the scene (assuming you are instantiating prefabs to create the list).
     
  7. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,471
    Yup... Let's say putting stuff in scenes isn't really a solution. But I guess it could work to track down where's the issue.
     
  8. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,471
    Turned all the RectMask2D into normal Mask, and it works.

    Sad for the performance, but I simply couldn't track what make the RectMask2D fail.