Search Unity

How to get the Javascript or unityscript whatever you call it to work? HELP

Discussion in 'Editor & General Support' started by HULKUM21, Mar 4, 2012.

  1. HULKUM21

    HULKUM21

    Joined:
    Mar 4, 2012
    Posts:
    21
    Hi Im new to Unity and I was wondering how to get the Javascript to work.Because everytime i try it it just says

    C:\my Documents\New Unity Project 1\Assets\MoveAround.js
    Line:1
    Char:1
    Error:Invalid Character
    Code: 800A03F6
    Source: Microsoft JScript compilation error

    Also says

    #Pragma Strict

    Function Start () {
    }

    Function Update () {

    }

    Also I have Microsoft Windows XP


    So could any one tell me how to solve this issue thanks
     
  2. OmniverseProduct

    OmniverseProduct

    Joined:
    Feb 26, 2012
    Posts:
    1,568
    are you using monodevelop? It sounds like you aren't. the best way to work with Unity's version of Javascript is to use monodevelop. As far as I know, Monodevelop is one of the only programs that can correctly run Unity Script.
     
  3. HULKUM21

    HULKUM21

    Joined:
    Mar 4, 2012
    Posts:
    21
    Ok I'am at there page but what version should I use?

    Monodevelop-Java

    or

    Monodevelop-Phython
     
  4. OmniverseProduct

    OmniverseProduct

    Joined:
    Feb 26, 2012
    Posts:
    1,568
    Use the monodevelop included with the unity editor
     
  5. HULKUM21

    HULKUM21

    Joined:
    Mar 4, 2012
    Posts:
    21
    Im completely lost here could you send me a link to that please?
     
  6. OmniverseProduct

    OmniverseProduct

    Joined:
    Feb 26, 2012
    Posts:
    1,568
    sure thing.

    http://unity3d.com/unity/download/

    Download and instal Unity first. You'll have to obtain a license for the free version. It should be self explanatory after you install unity.
     
  7. HULKUM21

    HULKUM21

    Joined:
    Mar 4, 2012
    Posts:
    21
    Oh Iv already installed unity that exact version. But what about the monodevelop thing the one with the unity editor that you were talking about?
     
  8. OmniverseProduct

    OmniverseProduct

    Joined:
    Feb 26, 2012
    Posts:
    1,568
  9. HULKUM21

    HULKUM21

    Joined:
    Mar 4, 2012
    Posts:
    21
    Nope No mono in that folder.Thanks for the documentation link
     
  10. OmniverseProduct

    OmniverseProduct

    Joined:
    Feb 26, 2012
    Posts:
    1,568
    Hmm, it sounds like it might not have installed when you installed Unity. Do you know how to create scripts inside Unity? Try creating a .js script inside the unity editor. The documentation should show you that just in case you don't know how. I'd post pictures, but I honestly don't know how to do a screen capture.
     
  11. HULKUM21

    HULKUM21

    Joined:
    Mar 4, 2012
    Posts:
    21
    So you would go to Create Java script but you no what ill send a screen shot of what going on
     
  12. HULKUM21

    HULKUM21

    Joined:
    Mar 4, 2012
    Posts:
    21
    OMG my computer pissing me off it aint letting me put it in the damn post
     
  13. OmniverseProduct

    OmniverseProduct

    Joined:
    Feb 26, 2012
    Posts:
    1,568
    Yes you would. Sorry if my explanations are a little mutilated. lol
     
  14. HULKUM21

    HULKUM21

    Joined:
    Mar 4, 2012
    Posts:
    21
    I cant even get into the script editor on the right side it just gives me the same bullcrap
    #Pragma Strict

    Function Start () {
    }

    Function Update () {

    }
     
  15. OmniverseProduct

    OmniverseProduct

    Joined:
    Feb 26, 2012
    Posts:
    1,568
    Have you tried reinstalling Unity? If that doesn't work you should probably fill out a bug report.
     
  16. DanielQuick

    DanielQuick

    Joined:
    Dec 31, 2010
    Posts:
    3,137
    To be sure, you created a JavaScript file, then double clicked it (in Unity) and nothing happened?
     
  17. HULKUM21

    HULKUM21

    Joined:
    Mar 4, 2012
    Posts:
    21
    But that will take ages
     
  18. HULKUM21

    HULKUM21

    Joined:
    Mar 4, 2012
    Posts:
    21
    No it just gave me a error message

    C:\my Documents\New Unity Project 1\Assets\MoveAround.js
    Line:1
    Char:1
    Error:Invalid Character
    Code: 800A03F6
    Source: Microsoft JScript compilation error
     
  19. HULKUM21

    HULKUM21

    Joined:
    Mar 4, 2012
    Posts:
    21
    Did any of yall ever have this issue?
     
  20. HULKUM21

    HULKUM21

    Joined:
    Mar 4, 2012
    Posts:
    21
    wait no it said monodevelop on the js file i created
     
  21. HULKUM21

    HULKUM21

    Joined:
    Mar 4, 2012
    Posts:
    21
    On the right side it just shows a gray space with

    #Pragma Strict

    Function Start () {
    }

    Function Update () {

    }
     
  22. George Foot

    George Foot

    Joined:
    Feb 22, 2012
    Posts:
    399
    That's all it's meant to show - it's the current content of your script. When you double-click it in the Project pane, it should open MonoDevelop (or another editor) and let you edit the script.
     
  23. HULKUM21

    HULKUM21

    Joined:
    Mar 4, 2012
    Posts:
    21
    OMG I double clicked them and they just give me a retarded error message! i give up
     
  24. George Foot

    George Foot

    Joined:
    Feb 22, 2012
    Posts:
    399
    Check the preferences on the edit menu, there's an option to choose which editor to use to edit scripts. Try notepad or something like that to see whether that works. On Mac I think it's on the system menu instead.
     
  25. HULKUM21

    HULKUM21

    Joined:
    Mar 4, 2012
    Posts:
    21
    Wait Wait I think I got it!@!!!!!!!!!!!!!!!!!e)(!)u(_

    so you would use the notepad to type the stuff in? But how would i get it into the game?
     
  26. George Foot

    George Foot

    Joined:
    Feb 22, 2012
    Posts:
    399
    I wouldn't choose to use Notepad - MonoDevelop is much better - but if it's not working for you then Notepad is an option. You can also use Visual Studio, if you have that.

    You don't need to "get it into the game" - it's already in your project, so whatever changes you make will be picked up when you switch focus back to Unity.
     
  27. Fu11English

    Fu11English

    Joined:
    Feb 27, 2012
    Posts:
    258
    For the most basic terms of programming with Unity you would attach a script to a gameObject and then the script will automatically be included in your game, providing the gameObject exists in your scene or it is instantiated at some point in time from another script.

    You would just type your script in notepad and save it with the .js file extension if using unityscript.

    It is really odd however why Unity isnt loading up monodevelop and you are getting errors.

    Have a look in your Unity installation directory such as c\program files\unity. In there should be two folders one called editor and one called monodevelop.

    If its there maybe try posting a video of your exact problem...
     
  28. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
    What does the text editor have to do with anything? You can use Notepad for crying out loud.
    Unity compiles the scripts using Mono, MonoDevelop has nothing to do with the whole thing.
     
  29. OmniverseProduct

    OmniverseProduct

    Joined:
    Feb 26, 2012
    Posts:
    1,568
    I don't know. Just wanted to ask.
     
  30. HULKUM21

    HULKUM21

    Joined:
    Mar 4, 2012
    Posts:
    21
    Why shouldent I use notepad is MONO just easy to use or something? anyways Beyond Basic Games I never found a mono file next to the editor file
    but there was something in the editor file that said mono but i cant open it cause its doing that "Open With" Crap but for the moment ill use notepad.But if you or anyone else has anything else to add go ahead.
     
    Last edited: Mar 5, 2012
  31. tatelax

    tatelax

    Joined:
    Feb 4, 2010
    Posts:
    1,168
    Mono color codes your scripts and makes it easier to navigate and edit multiple scripts.
     
  32. HULKUM21

    HULKUM21

    Joined:
    Mar 4, 2012
    Posts:
    21
    Oh ok so that means more work. Well i am off to go learn how to script
     
  33. travischance

    travischance

    Joined:
    May 11, 2012
    Posts:
    9
    i keep having the same issue. HAve ou figured out how to resolve it?
     
  34. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    I might be wrong with JS, but I think the language is CaSe senSiTiVe...

    #Pragma strict should be

    #pragma strict

    Function

    should be

    function

    And yes, get MonoDevelop, will make your life easier. Although C# and Visual Studio will make your life easiest.
     
  35. ViPxRampageXx

    ViPxRampageXx

    Joined:
    Oct 22, 2013
    Posts:
    1
    I think i worked out the problem when you installed unity you probably unticked to download monodevelop because thats what i did and i got the exact same error message
     
  36. Caden602

    Caden602

    Joined:
    Feb 27, 2016
    Posts:
    3
    I am currently having this issue and it is pissing me off
     
  37. Pekion6

    Pekion6

    Joined:
    Oct 4, 2018
    Posts:
    1
    not sure if anyone will ever even see this but it wont let me choose js it only lets me create a C# file
     
  38. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,443
    Yes, Javascript and Unityscript are no longer supported. You replied to a thread that was started in 2012, about a version of software nobody uses anymore.
     
  39. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Creating new js files via the editor was removed in 2017.2. The compiler itself I believe still exists, but expect problems with your UnityScript code since any work they do now they most likely are just ignoring how it may break anything with UnityScript. Since the announcement of UnityScript's removal was made over a year ago, I would think the final removal of the compiler would happen relatively soon and possibly without notice.

    https://blogs.unity3d.com/2017/08/11/unityscripts-long-ride-off-into-the-sunset/