Search Unity

Javascript not working in Unity.

Discussion in 'Scripting' started by StephenRJudge27, Nov 25, 2015.

  1. StephenRJudge27

    StephenRJudge27

    Joined:
    Sep 2, 2015
    Posts:
    24
    I am having trouble using Javascript. When I start a new script it is underlining the # in #pragma strict and then when I put in any variable such as var myInt : int = 5; it is underlining the : I don't understand this problem.
     
  2. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,359
    Show a script here so it'll be easier to solve a problem
     
  3. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,531
    What IDE are you using?

    Are errors showing up in Unity itself?

    Visual Studio doesn't work with JavaScript if you're using Visual Studio. It'll show errors, while Unity will not.

    Not sure about MonoDevelop... I'd assume it recognizes unityscript/javascript, but I never use that thing, so I couldn't tell ya.
     
  4. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    There is also the obvious, are you using a .cs file instead of a .js one?
     
  5. Yash987654321

    Yash987654321

    Joined:
    Oct 22, 2014
    Posts:
    729
    Wait to IDEs do not support JavaScript (at least MonoDevelop) So if it is compiling awesome! otherwise please provide the script. You can't be sure by just seeing a line below your code be confident!
     
  6. StephenRJudge27

    StephenRJudge27

    Joined:
    Sep 2, 2015
    Posts:
    24
    Thank you guys! You were right when I changed to MonoDevelop I did not have that problem anymore. Sorry for late response back.