Hello,
Apologies if this is covered somewhere already. I was unable to come up with a successful combination of search keys to look it up if it is.
Anyway, is there a size limit to a javascript script? I have moderately large script (around 1160 lines) that is having compilation problems, or more accurately Unity is no longer sniffing out the problems it should. The last few changes I’ve made to my script have had syntax errors (mostly misnamed boolean variables) that Unity has just been passing over and compiling anyway.
For instance I would have something like
victimRescued = true;
However I don’t actually have a variable defined as victimRescued, the definition is for this:
private var victimSaved : boolean = false;
However Unity just passed over the “victimRescued” and compiled it. As expected, the code wasn’t working because “victimSaved” was never getting set to true. So okay, maybe I was using “victimRescued” somewhere else . . . I then did a search through the code for “victimRescued” to find where it was defined and what I was using it for. The search turned up no results, which I found odd. So I then changed the line of code to:
victimsdjkshdfkajshd = true;
The above still compiled with no errors. Since then I’ve noticed problems with three or four other lines that seem to be invisible to the syntax checker.
[Update] - So this phenomenon is not limited to the script I was talking about above, it seems to be happening to other scripts as well (one I was just looking at was only 200 lines long). It seems to mostly ignore incorrect variable names, though not always. Semi-colons, parentheses, braces, etc. all seem to come up with errors when misplaced or missing, but incorrect variable names don’t trigger “unknown identifier” errors like they should . . . though sometimes they still do.
Is this a known issue? If so, what causes it? If it’s not a known issue, does anyone have any ideas what it could be?
Thanks,
~Rob