- Home /
Question by
LifeSizeDeity · Jul 07, 2011 at 05:55 PM ·
guitexturenullnone
Setting a guiTexture to Null
How would I set a guiTexture to Null or None in script?
Comment
Answer by GuyTidhar · Jul 07, 2011 at 06:25 PM
You probably need to destroy it.
GUITexture is a component therefor you need to destroy it and then you may set null to the variable if you wish.
For instance, if I had a script residing on the same GameObject that I had the GUITexture I no longer need, I would call the following:
Destroy(GetComponent.<GUITexture>());
or if I already had the reference to the GUITexture:
var myGuiTexReference : GUITexture = GetComponent.<GUITexture>();
Destroy(myGuiTexReference);
myGuiTexReference = null;