Instatiated object not being referenced in Start function?
Okay, so I have a script called player manager, this manager keeps control of two things, the prefab I'm instantiating, and the position. I also have a static game object that the clone is referenced under. When I call the player from another script in the start function, I don't get the player. If I call the player in the update function, I get the reference. I don't like coding inefficiently, so any help?
Answer by UsmanAbbasi · May 15, 2016 at 06:29 AM
Start() methods of different scripts can be called in any order so if you want to access some object in Start() method of any script, it must be initialized in Awake() method because it is guaranteed that Awake() of all the scripts are called before any Start() method.
Answer by $$anonymous$$ · May 15, 2016 at 08:14 AM
ahh, thank you! I was really unsure on why it wasn't working, well, I'm not using the way I was going to use, but now I know. Thank you very much!