-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
[4.1.dev.3] Multiplayer game crash: multiplayer can only be manipulated from the main thread #77707
Comments
Important note: the timer used here is the C# timer (System.Timers) and not the godot timer node. I believe this bug occurs because the native C# timer is not single-threaded. It worked on latest v4.0 stable version and the 2 dev snapshots of 4.1. Maybe this change is intended and is not a bug. |
You need to use other methods as you are not allowed to manipulate it from the main thread, use something like deferred calls, this is because processing got reworked on 4.1.dev I believe Don't think this is a bug Edit: My bad, didn't realize this was |
The godot/scene/main/scene_tree.cpp Line 1479 in d87bdef
This seems intentional, the PR says:
Using a Godot timer should avoid the issue since it will tick in the main thread. But if you want to keep using C# timers, you should be able to use var timer = new Timer(14000);
timer.Elapsed += (object sender, ElapsedEventArgs e) =>
{
Callable.From(() => RpcId(peerId, "UpdateFightStep", 1)).CallDeferred();
};
timer.AutoReset = true;
timer.Start(); |
Closing per comment above (and OP's acknowledgement of it). |
Godot version
v4.1.dev3.mono.official [a67d37f]
System information
Windows 11 - v4.1.dev3 - Vulkan
Issue description
Hello,
I'm playing with the latest 4.1 dev snapshot (3) and C#, and it seems that my multiplayer game crashes with the following stacktrace:
It's working correctly on 4.1 dev 1 and 4.1 dev 2 snapshots.
Steps to reproduce
A timer that trigger a simple function making an rpc call:
Minimal reproduction project
I will try to reproduce it in a small project.
The text was updated successfully, but these errors were encountered: