Author Topic: How to show and hide a Sprite?  (Read 2861 times)

ilovebird

  • Guest
How to show and hide a Sprite?
« 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!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to show and hide a Sprite?
« Reply #1 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.

ilovebird

  • Guest
Re: How to show and hide a Sprite?
« Reply #2 on: June 04, 2013, 01:08:06 AM »
Works! Thanks a lot.