unity-game-engineslidermaskmeshscrollrect

Mask on ScrollRect doesn't hide child mesh objects outside of the slider (but works for text)


I have a slider scrollrect object which I populate at run time with a bunch of space ship equipment and weapons which are prefabs. The prefabs have text objects (e.g. descriptions of the equipment) as well as mesh objects. The problem I'm having is that when the player scrolls through the prefabs and they slide outside the scrollrect perimeter the text is hidden (as it should be), but the meshes are NOT hidden!

Here's the scene setup: https://i.sstatic.net/sR97f.png

Any ideas what I'm doing wrong?


Solution

  • You can use a RenderTexture with a RawImage component and camera pointed on each inventory item. See https://answers.unity.com/questions/844742/render-texture-in-ui.html

    Otherwise prerender your items to thumbnail images.