Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Maxii on October 04, 2014, 03:35:22 PM

Title: Visibility Changed delegate?
Post by: Maxii on October 04, 2014, 03:35:22 PM
I'm looking for a way to be notified when a widget or panel transitions into/outof camera line of sight like MeshRenderer.OnBecameVisible/Invisible does for meshes. As UISprite doesn't use a MeshRenderer, I don't have that notification available to me.
Title: Re: Visibility Changed delegate?
Post by: ArenMook on October 05, 2014, 09:02:51 AM
UIWidget.isVisible tells you whether it's visible, but there is no delegate for this. You have to watch for it changing.
Title: Re: Visibility Changed delegate?
Post by: Maxii on October 05, 2014, 10:23:48 AM
Would you consider a feature request then?
Title: Re: Visibility Changed delegate?
Post by: ArenMook on October 06, 2014, 08:43:00 AM
It seems like this would add overhead to every single widget, even though in 99.9% of the use cases this isn't going to be used. I'd say this is best as an additional script attached to whatever you want to be tracking this kind of thing.
Title: Re: Visibility Changed delegate?
Post by: Maxii on October 06, 2014, 08:59:03 AM
Thanks for considering it. I take it you are referring to a script that polls isVisible during Update?
Title: Re: Visibility Changed delegate?
Post by: ArenMook on October 06, 2014, 10:39:00 AM
I'd put it in a coroutine, but yes.