Question by
Jaze_ · Apr 14, 2019 at 08:37 PM ·
gameobjectstart
Start() not called immediately in build, working fine in editor
Hello,
In my code I have something like this :
myGameObject.SetActive(true);
myGameObject.GetComponent<MyScript>().MyFunction();
The first line activates the game object for the first time. MyFunction requires Start() to have been run in MyScript. It works fine in the editor, however in build, MyFunction is called before Start has been called, hence triggering an error. Start would then be called.
What am I missing?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612195457im_/https://answers.unity.com/themes/thub/images/avi.jpg)