- Home /
Scroll Rect Content Disappearing (Video)
Hi,
I'm having some issues with the scroll rect not working on android. What happens is that when I activate the customize menu, the scroll rect works (cause you can see the colors change) but it's contents won't show or will sporadicly flicker for a ms and disappear. I've tried any possible way of showing and hiding. In the video I'm using canvas groups to set the alpha (but also tried with activate and inactivate). I've also tried waiting for several seconds (before and/or after pushing the customize button) but it won't show up. The curious thing is, after I play a game (duration not relevant) and after that if I push the customize button it does show up, but with a lag/loading time of more then 1 sec maybe less (I'm having the impression that it shows on touch). And when i close and reopen it won't show up again. The only possible idea I still have is that it has something to do with texture atlasses not loading correctly, cause now it's a bit of a mess in my project (but I have no idea if that is even possible?). There is no code that handle the showing or disappearing of the screens other then the X button and the Customize button, so that's not the issue.
Does anyone have even a clue what is happening here? In the editor everything works fine. Thank you upfront if this is fixable.
Hey i know you posted this a while ago but did you figure it out? Having the same issue. It works when I play the scene to test, but if I come into the scene from another it wont show. If i SetActive(false) then SetActive(true) again on the scrollRect it works.. But I shouldn't have to do that. Any tips would be helpful, thanks :)
Having the same problem here, a scroll rect shows content when I play in Unity, but in Android it disappears completly. Have you solved it?
Hey @HugoStudica I've had a lot of experience with Unity UI since I commented. It doesn't look like this is "solved" but i think the main cause of this is due to the rectTransform being dirty after instantiating objects into the scroll rect's content when there is a layout group on it. So therefore, after your instantiation loop add this utility function LayoutRebuilder.ForceRebuildLayoutImmediate(scrollRect.content)
. If that doesn't work, try adding this Canvas.ForceUpdateCanvases()
before the layout rebuilder. Hope that helps.
I didn't try this, but I solved with a different approach. I had two scroll rects with identical functionalities and values. The one that started inside the $$anonymous$$ain Canvas had no problem to show the content, but the other one that was outside the canvas couldn't render anything. So I've read some answers on the internet and I tried starting the application with a disabled ScrollRect and enble it in runtime. Weird, but it worked. I Guess it is somehow related to what your are refering.
The weridest thing about this problem is that it will never trigger in Unity, only in the Android Device.