Support => NGUI 3 Support => Topic started by: Oinobareion on November 13, 2013, 08:28:15 AM
Title: Check, if GameObject is inside UIPanel
Post by: Oinobareion on November 13, 2013, 08:28:15 AM
Hello everyone,
May be a simple question: Can I somehow check, if a GameObject is inside a UIPanel? I want to do something with the GameObject, as soon as it enters the panel. Is this possible?
Otherwise I would have to make a collider box as trigger and work with onTriggerEnter and onTriggerExit. I am wondering, if there's an easier way to do this.
Thanks for help!
Title: Re: Check, if GameObject is inside UIPanel
Post by: ArenMook on November 13, 2013, 03:40:41 PM
NGUIMath.Calculate series of functions can calculate the dimensions of a group of objects with UI elements on them, and you can then check it against the panel's clipping rect. NGUI does it to clip widgets (UIWidget.isVisible).
Title: Re: Check, if GameObject is inside UIPanel
Post by: Oinobareion on November 19, 2013, 09:24:08 AM
Thanks for the answer. I simply used the "isVisible" function to check, if a certain GameObject is inside the panel's bounds. I am sure there are more elaborate ways to achieve this, but at least it works :-) Here is my code: