Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only attach works with Godot 4.0 #38

Closed
markdibarry opened this issue Feb 14, 2022 · 5 comments · May be fixed by #56
Closed

Only attach works with Godot 4.0 #38

markdibarry opened this issue Feb 14, 2022 · 5 comments · May be fixed by #56
Assignees
Labels
bug Something isn't working

Comments

@markdibarry
Copy link

OS/device including version:
Windows 10

Issue description:
You can attach to a running instance, but Play in Editor, Launch, and Launch (Select Scene). Do not work.
Unexpectedly, Launch tries to build and run the current scene open in the editor, and crashes. I only noticed due to some _Ready() GD.Print() method calls printing from the current scene.

@markdibarry markdibarry added the bug Something isn't working label Feb 14, 2022
@raulsntos
Copy link
Member

raulsntos commented Feb 14, 2022

This extension was developed for Godot 3.x. It's likely that Godot 4.0's breaking changes made it incompatible with this extension and needs to be updated to support it.

I don't think it'd be very useful to start doing that work now since Godot 4.0 is still in alpha and the C# module is in the process of being ported to .NET 6.0.

By the way, Play in Editor and Launch just execute the Godot binary with some arguments (see https://docs.godotengine.org/en/latest/tutorials/editor/command_line_tutorial.html#command-line-reference).

@markdibarry
Copy link
Author

markdibarry commented Feb 14, 2022

All good points. If that's all there is to Launch and Play in Editor I'm confused why it'd try to run the currently open scene. Attach still works, and for the most part, if I'm trying to debug a scene and hit F5 fast enough I can get it to attach before it crashes, so I thought there was a chance that maybe another launch mode wouldn't be that far off, so was worth reporting. Obviously no official mono builds are released, but there are always the few like me who do custom builds to still be able to contribute bug tickets and PRs. If a separate extension is planned, rather than to work on compatibility for this one, it'd probably be a quick solution then to update the ReadMe to mention that, so further 4.0 bugs can be closed.

@raulsntos
Copy link
Member

raulsntos commented Feb 15, 2022

Just want to clarify that it should be opening the main scene, not the currently open the scene.

There could be a number of things changed in 4.0 that broke the extension, off the top of my head I remember the .mono folder was moved to .godot/mono where we store a metadata file with the port that the extension needs to attach the debugger so maybe that's what's causing the issue.

This metadata file is used by the Play in Editor mode and the path to the metadata file is set in:

this.projectMetadataDir = path.join(godotProjectDir, '.mono', 'metadata');

This should be replaced in 4.0 with:

this.projectMetadataDir = path.join(godotProjectDir, '.godot', 'mono', 'metadata');

As for Launch mode, it seems commit godotengine/godot@d79e28c broke it because the --remote-debug argument now must start with the protocol tcp:// which we don't include in:

"--remote-debug", $"{host}:{remoteDebugPort}",

To fix it for 4.0 it should be replaced with something like:

"--remote-debug", $"tcp://{host}:{remoteDebugPort}", 

Of course, making these changes would make it work for 4.0 but would break the extension for 3.x, if you need it you can make these changes and build the extension yourself and it should work for your 4.0 projects. As for this extensions, I don't think there are plans to create a separate extension for 4.0, I think detecting the Godot version or adding a configuration option would be good enough.

@markdibarry
Copy link
Author

markdibarry commented Feb 15, 2022

You were absolutely right. I created .mono/metadata directories in my project root and a ide_messaging_meta.txt with the same port number as the other one and Play in Editor now works. I'll try the changes you provided above. Seems like a pretty easy extra step to get things going in 4.0

Thanks!

Edit: I think that a configuration setting would be sufficient.

@markdibarry
Copy link
Author

As the merge to .NET 6 has happened, this is irrelevant.

@markdibarry markdibarry closed this as not planned Won't fix, can't repro, duplicate, stale Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants