Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Disastercake on November 18, 2014, 08:15:19 PM
-
UIProgressBar no longer has a cachedGameObject, and so no other components that derive from it do either (like scrollbars). Is this by design? It would be very useful if it remained in there.
-
cachedGameObject is on the UIRect, and only on the UIRect. It was never on the progress bar as far as I remember.
-
That's weird because I had code pointing to that variable previously. Perhaps I had hacked it in myself and forgot about it. Is it possible to add it in or are you wanting to avoid that? It's pretty useful to be able to toggle any NGUI component on and off for different menu items in the same panel (and know that it is automatically being cached).
-
What for? Just replace it with .gameObject.
-
I read that .gameObject has a lot of overhead to it, which is why people cache the game object (like NGUI does). Is that no longer the case?
-
Its certainly faster to cache it if you access it every frame. Are you accessing it every frame? If so, why do you need it on the progress bar? NGUI doesn't.
-
.gameObject doesn't have much of an overhead. At worst, the first time it's used, it counts as a GetComponent<GameObject>() and on later uses there's some form of internal caching which makes it faster. Not as fast as doing your own local reference, but almost. So, no real biggie unless it's in an update loop, in which case, make your own cached version.