Debugging in Unity (C#) + Visual Studio Code Work on OS X?

后端 未结 7 1867
小鲜肉
小鲜肉 2021-02-12 10:04

I really like the idea of working with Visual Studio, C# and Unity on OS X.

Has anyone made debugging with C# in Unity work with Visual Studio Code on OS X?

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-12 10:37

    It's a little unstable. But it's possible from recent VSC version.

    1) Install this VSC Unity plugin-in. https://github.com/dotBunny/VSCode/

    2) Follow these commands. (Step 1, 2 and 3) https://code.visualstudio.com/Docs/runtimes/unity

    3) After you complete the settings, launch the VSC using Unity menu.

    Assets/Open C# Project in Code
    

    4) Play the Unity project. You can see the debug port number on the unity console. And the project's launch.json file will be renewed automatically.

    To open launch.json, click option icons.
    the file exists in this folder.

    .vscode/launch.json
    

    sample.

    {
        "version":"0.1.0",
        "configurations":[ 
            {
                "name":"Unity",
                "type":"mono",
                "address":"localhost",
                "port":56621
            }
        ]
    }
    

    5) Start debug in VSC debug tab.

    That's it. Hope this help.

提交回复
热议问题