Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: noob22 on July 02, 2012, 12:15:54 AM

Title: How to find UI in runtime?
Post by: noob22 on July 02, 2012, 12:15:54 AM
Do I need to use U3D's API "FindChild"?It's not efficient!
Any suggestion?
Title: Re: How to find UI in runtime?
Post by: burtonposey on July 02, 2012, 12:35:02 AM
How many times do you need to find it? In most cases you should, at most, need to find it once and then store a reference to it in a class variable of whatever script you are trying to utilize it.
Title: Re: How to find UI in runtime?
Post by: noob22 on July 02, 2012, 12:52:42 AM
How many times do you need to find it? In most cases you should, at most, need to find it once and then store a reference to it in a class variable of whatever script you are trying to utilize it.
Thanks for your reply!
If I need to clone much UI sprite at random position.Sometimes they are visiable and sometimes they are invisiable.Do I use "Instantiate" and "Destroy"?It is not efficient!Any suggestion?
Title: Re: How to find UI in runtime?
Post by: ArenMook on July 02, 2012, 01:04:19 AM
Implementation details can vary greatly with what you're trying to do and the complexity of your UI. As Burton said though, find what you need once, and store the reference. Instantiate/destroy can be replaced with enable/disable instead.
Title: Re: How to find UI in runtime?
Post by: noob22 on July 02, 2012, 02:23:39 AM
Implementation details can vary greatly with what you're trying to do and the complexity of your UI. As Burton said though, find what you need once, and store the reference. Instantiate/destroy can be replaced with enable/disable instead.
Thanks for your reply!I have got it.