Enable/Disable GUI on GameObject

Hi to all,

i want to know how can i enable or disable the GUI effects on a script aplied to a GameObject?

using a variable on another script to handle the GameObject.

Thanks!

use delegates such as

if(something happens)
{
ThisGUI ();
}
else
{
ThatGUI ();
}

In the player script i have a variable called “target” with the transform of a GameObject, i want to enable/disable the GUI effects on a script aplied to the target… let’s call this script GUIScript… i tried this:

GUIScript ex = target.gameObject.GetComponent(GUIScript);
ex.enabled = false;

but the Unity3D tells me that i cant transform the variable ex (type: GUIScript) into a new type called COMPONENT…
The code you told me in my project will get more process to do the same thing… If i get it right

try it my way, it is guaranteed to work.

Hi Feyhu,

Thanks for your help, i will try it tomorrow and i will give a feedback!

Thanks again ^^

also, try searching the subject on the forum, I found it easily