I'm trying to reference my GameMaster script in my player script in the Start() function. But I'm getting a "Object not set to an instance" Error. Seems like the GameMaster isn't ready for referencing at that point. I tried to put it above the default execution time. But still no script seem to be able to get a refeernce of GameMaster. My solution was to try to reference it in Update like: if (gameMaster == null){ gameMaster = GameObject.Find ("GameMaster").GetComponent<GameMaster> (); } and it works on the second frame. Anyone a better solution?
You could make a persistent DontDestroyOnLoad gameObject will all persistent game controlling scripts then use a singleton design pattern. Code (csharp): public static GameMasterScript singleton {get; private set} public void Awake() { singleton = this } [//CODE] Also this may not be the right subforum for this question.
I have a list of Players in the Synchronizer (I think that is your GameMasterScript) that on Awake of every Player subscribe itself in that list to not using tags and finding objects, that methods are too expensive As @Zullar says, I think this is not the best subforum to ask this XD