Search Unity

Can't open Javascript!

Discussion in 'Editor & General Support' started by gamma3894, Jul 31, 2012.

  1. gamma3894

    gamma3894

    Joined:
    Jul 31, 2012
    Posts:
    4
    I'm working on a platform game with the help of a platform tutorial, and I wanted to make a script called Platform Controller for my player. But every time I try to edit it, this pop-up window comes out:

    Windows Script Host

    Script: C:/Users/TOSHIBA/Documents/New Unity Project/Assets/PlatformController.js
    Line: 1
    Char: 1
    Error: Invalid character
    Code: 800A03f6
    Source: Microsoft JScript compilation error

    I am completely new to Unity and I have no idea what the above means. Can someone tell me what this means and how can I solve this problem?

    Thank you!
     
  2. UnityCoder

    UnityCoder

    Joined:
    Dec 8, 2011
    Posts:
    534
    Just post ur script with Code Tag. So people can see ur code and tell u what is the problem. OK..
     
  3. gamma3894

    gamma3894

    Joined:
    Jul 31, 2012
    Posts:
    4
    Umm.. I'm sorry but how do you post your script with a Code Tag and what is a Code Tag? Also, I haven't added anything to the script since I'm not able to open it.
     
  4. UnityCoder

    UnityCoder

    Joined:
    Dec 8, 2011
    Posts:
    534
    Just click on Reply>>Go Advance and now here u find so many options or u can also paste ur code directly, but its not look good.
     
  5. gamma3894

    gamma3894

    Joined:
    Jul 31, 2012
    Posts:
    4
    Okay, so I've attached the script but that's not exactly my problem. The problem is: from my own computer, I'm not able to open or edit the script because of some Microsoft Visual problem like the above.
     

    Attached Files:

  6. Zerot

    Zerot

    Joined:
    Jul 13, 2011
    Posts:
    135
    erm, it looks like you are trying to open the js file in internet explorer. If you double click a js file in unity, it should open it in monodevelop. You can also use any other text editor to edit the file. Just don't double click it in the explorer.
     
  7. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Hi gamma3894,

    The error message you get comes from a microsoft tool called ScriptHost. This has nothing whatsoever to do with Unity... It probably means that you have files with a .js file extension associated with that MS tool. Usually you'd create a JavaScript file from inside the Unity editor. When you edit it that file from Unity you should get a tool called MonoDevelop open which will allow you to edit the JavaScript. Instead you're getting the Windows ScriptHost, which is trying to execute the code, and is complaining about the # character. If you are trying to edit JS files from outside Unity, try using Right-Click Open With instead of double clicking. Perhaps choose either MonoDevelop or Notepad.

    HTH,
    Graham
     
  8. gamma3894

    gamma3894

    Joined:
    Jul 31, 2012
    Posts:
    4
    Ohh! Thank you so much Graham! What was I thinking? I didn't include installing Monodevelop as I thought that would be unnecessary. Thank you very much for your help!
     
  9. NiiloET

    NiiloET

    Joined:
    Jan 26, 2015
    Posts:
    8
    Monodevelop doesn't help, same error :(
     
  10. NiiloET

    NiiloET

    Joined:
    Jan 26, 2015
    Posts:
    8
    But i dont know did I all right becouse i just tried to open the script without doing anything
     
  11. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    You should also install MonoDevelop. When you install Unity, it asks you whether you want MonoDevelop as well and the answer is yes, you do.
     
  12. NiiloET

    NiiloET

    Joined:
    Jan 26, 2015
    Posts:
    8
    and its not monodevelop it is xamarin sorry i am noob
     
  13. NiiloET

    NiiloET

    Joined:
    Jan 26, 2015
    Posts:
    8
    I've installed monodevelop from net but its something called xamarin
     
  14. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Make sure to install the MonoDevelop that comes with Unity. It is not the same version, that's why it is important to have that one.
     
  15. NiiloET

    NiiloET

    Joined:
    Jan 26, 2015
    Posts:
    8
    can somebody pls help me :,(
     
  16. NiiloET

    NiiloET

    Joined:
    Jan 26, 2015
    Posts:
    8
    I think i didnt install it with unity so how can i install it in unity
     
  17. NiiloET

    NiiloET

    Joined:
    Jan 26, 2015
    Posts:
    8
    HEEEEELP!!!!!!
     
  18. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    How about just installing Unity again with the required components like MonoDevelop?
     
  19. NiiloET

    NiiloET

    Joined:
    Jan 26, 2015
    Posts:
    8
  20. WikiMalik

    WikiMalik

    Joined:
    Nov 13, 2014
    Posts:
    16
    Why would it happen in the first place? I can't see mono.exe (just mono.pdb) in the editor folder. Did monodevelop not install with unity installation, what's the solution?
     
  21. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Because the PC has ScriptHost installed and has registered JS file extensions.