Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Scripts Not Opening When I Double Click

Discussion in 'Code Editors & IDEs' started by MaestroMarcus, Aug 5, 2023.

  1. MaestroMarcus

    MaestroMarcus

    Joined:
    Jan 22, 2023
    Posts:
    10
    I recently moved my Visual Studio Code application from the Downloads folder to Applications (So I could update it, as it won't update when in the Downloads folder). But now when I double click a script in Unity it won't open, how do I get this working again? Does it have something to do with the change of file directory?
     
  2. tleylan

    tleylan

    Joined:
    Jun 17, 2020
    Posts:
    521
    Sounds reasonable. Your Unity setup includes a path to the code editor, I assume it is pointing to where it used to be. Check Edit/Preferences/External Tools/External Script Editor
     
    MaestroMarcus likes this.
  3. MaestroMarcus

    MaestroMarcus

    Joined:
    Jan 22, 2023
    Posts:
    10
    I'm in External Tools, it looks like Unity still has VSCode as the script editor. Is there something else on the page I need to check?

    Edit: I reset the argument and now everything's working again (except errors still aren't being highlighted when I make them).
    I've already installed Mono but VSCode keeps asking me to install it, does that have anything to do with this?
     
    Last edited: Aug 9, 2023
  4. tleylan

    tleylan

    Joined:
    Jun 17, 2020
    Posts:
    521
    This would be something that the folks who support VSCode (and the Unity Extension) will have to answer. I use VSCode for lots of things but Visual Studio Community for Unity. It's free perhaps give it a try.
     
    MaestroMarcus likes this.
  5. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    149
    With the new Unity extension for VSCode, there is no need for mono anymore. My guess is that you are using an old C# extension (v1.x) in VSCode. Please make sure you are using the following versions:

    Extensions in Unity:
    • VS Editor Package (v2.0.20)
    Extensions in VSCode:
    • C# (v2.0.320)
    • C# Dev Kit (v0.4.2)
    • Unity (v0.9.0)
    Then make sure VSCode is set as your preferred Editor in Unity. You should have something like this:

    upload_2023-8-10_9-8-40.png

    upload_2023-8-10_9-10-23.png
     
    MaestroMarcus likes this.
  6. MaestroMarcus

    MaestroMarcus

    Joined:
    Jan 22, 2023
    Posts:
    10
    Thanks guys, my error detection is working again
     
  7. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    149
    Perfect!