Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: ilovebird on June 03, 2013, 10:53:09 PM

Title: How to show and hide a Sprite?
Post by: ilovebird on June 03, 2013, 10:53:09 PM
I did it like this:

NGUITools.SetActive(GameObject.Find("GameTitle"), false);

but when I want to show it, I don't know how to do, because GameObject.Find("GameTitle") returns null

I wrote scripts:
public GameObject GameTitle;

But I can't drag my sprite to GameTitle.

anybody knows about it? Thanks!
Title: Re: How to show and hide a Sprite?
Post by: ArenMook on June 03, 2013, 11:39:52 PM
Never ever use GameObject.Find.

Create a public variable instead and drag & drop the value in the inspector.
Title: Re: How to show and hide a Sprite?
Post by: ilovebird on June 04, 2013, 01:08:06 AM
Works! Thanks a lot.