Hi
What does it mean?
if (!GameObject.FindGameObjectWithTag(“E”))
It’s if the game object with that tag isn’t find?
It can be read as : If FindGameObjectWithTag does NOT return a reference to anything.
But I’m actually not sure, can you post where you’re seeing this from?
In Make a Game course, In GameMaster script, we have :
var musicPreFab : Transform; function Start () { if(!GameObject.FindGameObjectWithTag("MM")) var mManager = Instantiate (musicPreFab, transform.position, Quaternion.identity); mManager.name = musicPreFab.name; DontDestroyOnLoad (mManager); }
I want to say, when there isn’t any gameobject with “e” tag, do OnGUI ();
What should I do?
to do something on gui just simply use that function on gui, or make a boolean trigger, so if the gameobject isnt in the scene, activate a bool, and in the OnGUI function check that bool and do something, you got it?
EDIT—— EXAMPLE:
var trigger : boolean; function Start () { if(!GameObject.FindGameObjectWithTag("MM")) { trigger = true; } else{trigger = false;} } function OnGUI(){ if(trigger){ // SOME GUI STUFF TO DO HERE } }
that is like: if the script CANT find that gameobject DO something, only if you CANT find it… i guess D:
i never did that anyway xD