I made a level menu on a Scroll Rect with 30 levels on it, for a 2d puzzle game for iOS.
I will add more levels soon, but I realize that when more objects add on the Scroll Rect content and I test the game runs more slowly.
So I want to disable the objects (In this case are just Images and Text components for the levels button and number) when there are off screen, and enabled them again when On Screen.
I tried adding BoxCollider2D on the objects and making a BoxTrigger on the top of the UI so when OnTriggerEnter2D disabled the Objects. The problem was (beside they don’t disable) I can’t enabled them again.
I’m hoping someone known a better way to do this please.
Also I think in something like Camera.ViewPortToScreenPoint for enable or disable in some specific Y (transform) position, but I’m getting confused applying it.