- Home /
Javascript literal error: unexpected identifier
In my playerScript i tried to make a literal to hold a package of data for casting a spell. it loosk like this:
 var playerSpell = {
     SpCost : 0.0,
     SpCost2 : 0.0,
     SpDelivery : "",
     SpSubDelivery : "",
     SpEffect : "",
     SpMod1: "",
     SpMod2: "",
     SpMod3: "",
     SpMod4: "",
     SpMod5: "",
     SpDamage :0.0,
     SpDuration :0.0,
     SpForce :0.0,
     SpProjectile :0.0,
     SpProjectilesSize :0.0,
     SpFireRate :0.0,
     SpChargeMax :0.0
 };
but every one of the variables triggers an "unexpected identifier" error. I'm not sure if this is just a syntax error, or if unity doesnt allow this kind of thing or what. If anyone knows id appreciate some help.
Answer by Eric5h5 · May 03, 2013 at 05:05 PM
Unity doesn't use Javascript. Though it might be inaccurately called that, it's better known as Unityscript, since it's unique to Unity. (And far better than Javascript. ;) Not to mention largely incompatible with it.) You'd be much better off using ActionScript 3 as a "template" for Unityscript, rather than Javascript. As such, you use classes like ActionScript 3 (or C# for that matter, though the syntax is mostly like ActionScript 3).
ahh i see, thanks for the clarification. since posting this i found a nice website that shows a unityscript example of what i was trying to achieve.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                