|
I'm working on this script to make a day and night time system for our game. The problem is I get these errors in Unity's console "Assets/TimeOfDay.js(38,1): BCE0043: Unexpected token: public. " "Assets/TimeOfDay.js(38,18): BCE0043: Unexpected token: (. " after each of my classes. Also I wanted to know what the best program is to edit scripts with . I tried setting Eclipse up with Unity but I got errors every time i coded with it. Also there was no syntex highlighting for Untitys JavaScript. why does this site keep taking my classes out of the code?
(comments are locked)
|
|
You don't seem to be using your classes correctly. You don't just call It looks like you actually want to use functions instead:
or you could use an enum and a switch statement. yea right now the classes are empty till the animator gives me the tag names of the items that will be edited. in the meantime im setting up the frame work . why would I want to use a function instead of a class? yea this is my first time using JavaScript , normally I'm a Java / Pawn programmer .
Jan 15 '11 at 02:06 PM
jchase520
and I would have used a switch statement instead of so many if else's but i don't think you can with multiple conditions in the switch parameters in JavaScript can you?
Jan 15 '11 at 02:09 PM
jchase520
If your a java programmer, then you should use C#, it will feel much more familiar to you. You would use a function because your current syntax is not correct, js will think what you are currently doing in the if statements is a method call, and that is probably why it is confused that you are defining it as a class further down.
Jan 15 '11 at 02:19 PM
Peter G
wouldn't it be better to just use the class syntex correctly?
Jan 15 '11 at 02:21 PM
jchase520
I don't know how you are setting up your frameworks, but if you just want to change a few settings, a method makes more sense to me because you can just call it once and be done with it.
Jan 15 '11 at 02:22 PM
Peter G
(comments are locked)
|
