Open Regrad opened 1 year ago
cc @Faless
I also noticed that get_parent().add_child also causes error "The multiplayer instance isn't currently active" in this situation. It is very strange. Perhaps this is due to MultiplayerSpawner.
i had a similar setup to this one, i quit the game and a few of these errors you mention showed up to me where i checked for authority what i found interesting though is that if i tried rejoining the server, the "get_unique_id()" function also returns an error. "The multiplayer instance isn't currently active."
+1 also experiencing this error. I am using the MultiplayerSpawner. On my server, before I call enet_peer.close()
, I first call enet_peer.disconnect_peer(peer)
for every peer connected to the server so every client can handle the server closing gracefully. But I am getting these errors of The multiplayer instance isn't currently active.
when the call to is_multiplayer_authority()
happens inside my _physics_process()
on my clients that get disconnected
Currently using "Godot 4.1.stable"
Same here, Godot 4.1.stable as well. tried with enet_peer.disconnect_peer(peer)
and without, always getting this error in _process()
and _unhandled_input()
for both client and server, though turning server or client on again fixes it and returns controls. Manually created a variable to for that script to not bother checking if my in_multiplayer == false
, one working workaround for now.
We're getting this on the mirror and it's causing us some issues when rejoining game sessions.
If _is_active
was exposed we could use this and just check the status in our own wrappers/code.
We're getting this on the mirror and it's causing us some issues when rejoining game sessions.
If
_is_active
was exposed we could use this and just check the status in our own wrappers/code.
Can you show an example please using _is_active in code to avoid that errors ?
yup having the same problem, after calling enet_peer.close()
any place in the code that uses multiplayer
throws the error.
yup having the same problem, after calling
enet_peer.close()
any place in the code that usesmultiplayer
throws the error.
okay thanks
I found a work around, or perhaps how its intended to be done?
I noticed that at the startup of a game multiplayer.multiplayer_peer
equals a instance of OfflineMultiplayerPeer
, so...
Closing the server like this works, and the error The multiplayer instance isn't currently active is no longer thrown.
multiplayer.multiplayer_peer = OfflineMultiplayerPeer.new()
enet_server.close()
thanks bro kravohi
Same here, Godot 4.3 dev6 as well.
Godot version
4.0.3
System information
Windows 11
Issue description
When starting the game (multiplayer server not started), if do "print (is_multiplayer_authority())" gives "True", but after server_custom.close () (close the server) an error starts to appear "The multiplayer instance isn't currently active". Thus, all further calls to network functions begin to produce errors. Thus, if a player after a network game wants to go into a single player game, the game will spam errors. If he starts a single player game right away, there will be no errors. This problem occurs not only with "is_multiplayer_authority()", but also with some other network functions or nodes.
I think is_multiplayer_authority() should either throw an error right away (it returns true now before the server is created, as if Godot is running the server by default) or not throw any errors after the server is closed. The second option is much more preferable. I hope I managed to explain the problem.
Steps to reproduce
Before starting the server, check "print (is_multiplayer_authority())", then start the server, close it and check again
Minimal reproduction project