Hey guys.
So basically I'm making an EditorWindow class to display various custom functions and well, anyway, I need to access a GameObject from the Hierarchy(in-game) in Editor mode. I'm using a simple:
if(!GameObject.Find("$MyGO")){
myGO = new GameObject(); myGO.name = "$MyGO";
}
Now it will create the GameObject once, and only once. Yet I 'lose the reference' as soon as the if(){} block end (myGO return null).
I'm using a JScript class located in my Plugins folder as an EditorWindow. The function is static and so is the variable, declared and casted outside the function, inside the class.
Any hints/tips on what's happening/what I should do? Thanks!