Skip to content

Setting up Vimspector for Unity

Leonid Kapitonov edited this page Jun 1, 2022 · 3 revisions

Dependencies

  • vscode-unity-debug, which can be installed with vscode or built from source
  • optionally, if debugger won't attach, Mono (make sure that the mono executable is in the system's PATH environment variable)

Setup

  1. Add a new adapter in .gadgets.json, which can be found in /path/to/vimspector>/gadgets/<os>

    {
       "adapters":{
          ...
    
          "unity-debug":{
             "attach":{
                "pidSelect":"none"
             },
             "command":[
                "/path/to/vscode-unity-debug/UnityDebug"
             ],
             "configuration":{
                "name":"Unity Editor"
             },
             "name":"unity-debug"
          }
       }
    }
  2. Add .vimspector.json configuration

    {
        "configurations": {
            "UnityDebug-Editor": {
                "adapter": "unity-debug",
                "configuration": {
                    "request": "attach",
                    "name": "Unity Editor"
                }
            }
        }
    }
  3. Run the debugger!

Debug configuration

  • name: specifies which window to debug. The possible values are:
    • unity editor or Unity Editor
    • osx player or OSXPlayer
    • windows player or WindowsPlayer
    • linux player or LinuxPlayer
    • ios player or iPhonePlayer
    • android player or AndroidPlayer
    • ps4 player or PS4Player
    • xbox one player or XboxOnePlayer
    • switch player or SwitchPlayer