Search Unity

Opening Scene opens text file

Discussion in 'Editor & General Support' started by Prospie, Aug 22, 2019.

  1. Prospie

    Prospie

    Joined:
    Oct 21, 2018
    Posts:
    3
    I recently changed versions of unity (to 2019.2) for a project I was working on and now when I double click on a scene in the inspector it does not load the scene in the hierarchy but instead, it opens the .unity file in my text editor. Please help. thank you
     
    mikapote and ScaniX like this.
  2. Scabbage

    Scabbage

    Joined:
    Dec 11, 2014
    Posts:
    268
    You probably need to associate .unity files with the Unity editor.

    If you're on Windows, right click the scene file > show in explorer.
    Right click the scene file > open with > select Unity.
     
    Prospie likes this.
  3. Prospie

    Prospie

    Joined:
    Oct 21, 2018
    Posts:
    3
    This opens the scenes as the desired but it seems to only do it when I take all of those steps and does not reset that as the default action, suggestions for making it permanent?

    I have tried selecting the box, "always use this app to open .unity files" and it does not fix it
     
  4. ScaniX

    ScaniX

    Joined:
    Apr 10, 2016
    Posts:
    31
    I have exactly the same problem (I think). After upgrading to Unity 2019.2.2f1, everything I double click in the project tab is opened in VS Code instead. Prefabs, scenes and even images are all opened in VS Code using double click or "Open" from the context menu. The AssetDatabase is always calling CodeEditor.OnOpenAsset() (and the VSCodeScriptEditor is then opening VS Code).
    If I disable the VS Code support package, that bug is gone, but I also cannot edit scripts anymore. I kinda fixed this for me by returning false in VSCodeScriptEditor.OpenProject() when the path does not end with ".cs", but it is a very annoying bug and there should be an official fix for it as Unity always overwrite my fix again.
     
    Last edited: Aug 22, 2019
    mikapote likes this.
  5. Zwilnik

    Zwilnik

    Joined:
    Jul 22, 2014
    Posts:
    62
    Switching External Script Editor to Open by File Extension appears to fix it here at least.
     
    godson3839 likes this.
  6. Deleted User

    Deleted User

    Guest

    Why in the Inspector? To open a scene, you need to double-click on it in the Project view not on the "Open" button in the Instpector.

    Capture.JPG
     
  7. mikapote

    mikapote

    Joined:
    Oct 24, 2018
    Posts:
    28
    I'm pretty sure that is what @WokeProspie meant. I've got the exact same bug after updating Unity to 2019.2.2, can't open anything in the editor anymore, Unity always open VS Code instead. @Zwilnik fix doesn't work for me (setting is already set to Open by File Extension). Will try to downgrade to 2019.2.1.
     
    ScaniX likes this.
  8. Subhajit-Nath

    Subhajit-Nath

    Joined:
    Dec 9, 2012
    Posts:
    31
    Now everything opens in vs code. That's very efficient and timesaving workflow imho.
     
    mikapote likes this.
  9. ScaniX

    ScaniX

    Joined:
    Apr 10, 2016
    Posts:
    31
    For anyone REALLY wanting to use 2019.2.2f1:
    I fixed that behaviour for me by copying the Visual Studio Code package from the Library/PackageCache folder to my normal assets Editor folder (otherwise Unity keeps overwriting my changes).
    Then added these lines to the beginning of VSCodeScriptEditor.OpenProject();

    if (path != "" && !path.EndsWith(".cs")) {
    return false;
    }

    I still downgraded to an older version, because there were other errors for me, too.
     
  10. rohitvishwakarma1819

    rohitvishwakarma1819

    Joined:
    Feb 15, 2018
    Posts:
    14
    Go to Window tab in Unity --> Package Manager --> search Visual studio code --> Change the version of Vs code Package
     
    doomtoo likes this.
  11. doomtoo

    doomtoo

    Joined:
    Feb 16, 2015
    Posts:
    41
    I had the same problem, 'rohitvishwakarma1819's solution worked for me- you have to update the visual studio code version unity is using by default.....
    Window->Package Manager-> Visual Studio code editor-> down arrow next to it-> select latest version (1.1.2) and update.

    After that, I could actually use Unity to open scenes -_-

    You got to wonder who QA's these things (and why they can't roll out patches for bugs that break being able to use Unity, instead of needing to download the behemoth over and over again)
     
  12. sudunity12

    sudunity12

    Joined:
    Feb 10, 2018
    Posts:
    14
    I also had the same problem, above solution work for me.
    update visual studio code editor from package manager.