Hey,
I'm currently facing a strange issue. As I have a scene with a script in which I call
1. Start()
{
Invoke("myFunction", 2);
Debug.Log("Start called");
}
2. function myFunction ()
{
Debug.Log("myFunction called");
}
So this works perfectly as long as I load that scene in the editor as the first scene. Now if I call that scene over Application.loadLevel() the Invoke will not be called. But if don't call myFunction as an Invoke() but simply as myFunction() it will get called. I don't get any Errors on that and as I get the Debug "Start called" I am assuming that the invoke somehow gets executed?!
I know that there are other coding possibilities to achieve the same effect as with the Invoke function, but I would like to know why an Invoke inside of Start() won't work when the scene is loaded via Application.loadLevel() but does when I start it. That doesn't make any sense to me and I couldn't find any information on that.
I'm using Unity 4.5.5f1 for Mac developing for iOS if that might matter.
↧