Hi,
I'm currently having issues using the GameObject.Find(String) method.
My game is sending a message to my server thanks to a GameObject and once the server is answering to me, I'm analyzing its response in another GameObject.
Here is the method sending the message to the server in my GameObject XMLParser :
function Awake() {
FindObjectOfType(NetworkRedDwarf).Send("getArtefacts"); // this method works fine
}
And here is the method called to analyze the answer in my GameObject NetworkRedDwarf :
``` public void analyzer(string commande, string args) { GameObject xmlParser = GameObject.Find("XMLParser"); // my game crashes here xmlParser.SendMessage("build", args); } }
And here the error given by the console :
UnityEngine.GameObject:Find(String)
NetworkRedDwarf:analyzer(String, String) (at Assets\Standard Assets\Network\NetworkRedDwarf.cs:73)
```
I'm still looking for a solution. Any idea on what's going on ? Is it because my XMLParser GameObject isn't totally built (I'm using the Awake method) ?
Any help would be appreciated.
Thanks !
Thanks for your reply. I checked my scene by pausing the game and my GameObject called XMLParser seems to be present (but I paused it after the crash, maybe juste before the call to Find, my GameObject is not present). The game crashes if I don't use the method SendMessage and even if I try to locate another GameObject (not matter which one). That's weird.
– anon26345769