I have a script attached to a prefab, but when i instantiate it, it doesn't seem to execute update(). Here is my code from justpasteit.
I have my code store Time.time into a variable called curTime, but it doesn't seem to do it, it stays at 0. Nothing else modifies this value. 0 is what i initialized it to tho.
When i change curTime to initialize to 5, it shows up as zero in the editor when i play my game. I also changed my variable to private, then to public again (to make sure the inspector isn't overriding the value in the script).
Another problem is that a function that prints a string to a guiText gameobject doesn't seem to be called. It calls fine in all other methods, but not update. (and there isn't a null reference). What could cause this?
asked May 23 '12 at 10:26 PM
I found the answer. It is from unity not being able to handle "no touches" when building for a mobile touch device (iOS / android) and throws a nullreference whenever you reference a touch without checking before hand if touchCount > 0. Unity reported a null reference in my camera controller script (but it always did this and other updates methods would be called just fine) but for some reason unity kept skipping my builder and buildqueue update method calls. When i fixed this error: Input.GetTouch(0).position, my update calls were then being completed more than the first frame for my builder stuff. I am starting to hate unity and how it handles mobile and exceptions but doesnt tell you any extra info, we just have to know. I assumed since this exception happene din main it would just skip my cameraController script's update(), but that apparently was the case here. I wish they would improve debugging.
I could have caught this with unity remote, but their latest version for android is broke and doesn't work with the latest unity and they dont seem to care to update it, which is quite sad.
answered May 25 '12 at 06:34 PM