- Home /
Start/Awake cut off at a certain point?
I've noticed that the Start()
and Awake()
methods won't read all the way through (I'm using C#, I don't know if the same issue would come up with JS), after a certain amount of code is added. I had spent a great deal of time debugging before I realized this was the issue I was running into, the first time... Can anyone give me any sort of confirmation that this is -supposed- to happen, and how much memory/time/whatever these methods are allotted before they are cut off?
I should note, as soon as I replaced the script with a method call, and copied/pasted all the exact code from those methods into there, it all executed just fine.
Thanks!
Answer by Bluk · Aug 06, 2012 at 04:39 PM
Hi,
I didn't find any evidence that there is indeed a time cap into Start()
and Awake()
. I tested this in JS:
function Start () {
for (var i =0 ; i<Mathf.Infinity; i++)
{
Debug.Log("Lol");
}
}
And it just seems to loop forever (as it should), i waited like 2 mins.
Maybe it is on the amount of code, but I don't think so. My best guess is that you were doing some stuff on objects that weren't yet properly initialized.
Cheers,
Bluk
Yeah, I'm not really sure what happened, to be honest, but I had used a for loop with C# with setting a number of different variables. It's not a massive problem, but I was curious if anyone knew if there was, in fact, a limit, since as soon as I redirected the code through a void method, it worked fine. It might be the way Unity runs C# code, but I don't know for sure.
I appreciate the effort, though!
I'm just gonna go ahead and call this one a bug, or something, since I haven't actually run into this issue again, since. Thanks for the help! :D