godotengine / godot-csharp-vscode

Debugger and utilities for working with Godot C# projects in VSCode
https://marketplace.visualstudio.com/items?itemName=neikeq.godot-csharp-vscode
MIT License
146 stars 27 forks source link

MacOS Play in editor not work #63

Open KarryCharon opened 8 months ago

KarryCharon commented 8 months ago

OS/device including version:

OS: MacOS Sonoma 14.3.1 GPU: M2 Max RAM: 64GB

Issue description:

The Play in editor config cant run. No log found! launch.json like that:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Play in Editor",
            "type": "godot-mono",
            "mode": "playInEditor",
            "request": "launch"
        },
        {
            "name": "Launch",
            "type": "godot-mono",
            "request": "launch",
            "mode": "executable",
            "preLaunchTask": "build",
            "executable": "/Users/xxx/Desktop/Godot 4.1.app/Contents/MacOS/Godot",
            "executableArguments": [
                "--path",
                "${workspaceRoot}"
            ]
        },
        {
            "name": "Launch (Select Scene)",
            "type": "godot-mono",
            "request": "launch",
            "mode": "executable",
            "preLaunchTask": "build",
            "executable": "/Users/xxx/Desktop/Godot 4.1.app/Contents/MacOS/Godot",
            "executableArguments": [
                "--path",
                "${workspaceRoot}",
                "${command:SelectLaunchScene}"
            ]
        },
        {
            "name": "Attach",
            "type": "godot-mono",
            "request": "attach",
            "address": "localhost",
            "port": 23685
        }
    ]
}

Screenshots of issue:

raulsntos commented 8 months ago

It looks like you are trying to use the extension with Godot 4.x. This extension does not support Godot 4.x, only 3.x.

To debug in Godot 4.x, use the Microsoft C# extension and configure your launch.json file to launch the Godot binary, here's an example:

{
    "version": "2.0.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "/Users/xxx/Desktop/Godot 4.1.app/Contents/MacOS/Godot",
            // See which arguments are available here:
            // https://docs.godotengine.org/en/stable/getting_started/editor/command_line_tutorial.html
            "args": [
                "--path",
                "${workspaceRoot}"
            ],
            "cwd": "${workspaceRoot}",
            "stopAtEntry": false,
            "console": "externalTerminal"
        }
    ]
}
KarryCharon commented 8 months ago

@raulsntos Thank you very much for your reply. It works now, but the preLaunchTask item should be delete else stuck.