You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In multiplayer, during a remote procedure call (RPC), I noticed that multiplayer.get_remote_sender_id() gives inconsistent results after a line with the 'await' keyword (or at least results that are unexpected to me.)
After a line with the await keyword, the result of multiplayer.get_remote_sender_id() is 0, instead of the actual remote sender ID. Before the line with the await keyword, it gives the sender ID just fine. It seems that after await, if forgets that it's in the rpc?
@rpc("any_peer", "call_remote", "reliable")
funcexample_rpc():
print("1. Received from: ", multiplayer.get_remote_sender_id()) # An ID like: 134295262awaitget_tree().create_timer(0.1).timeoutprint("2. Received from: ", multiplayer.get_remote_sender_id()) # Always 0
Maybe this is the expected behavior, but in that case it should maybe be added to the documentation?
Steps to reproduce
Start two instances of the MRP (below). In the first instance, click the server button (which starts a server). In the second, click the client button (which starts a client, connects to the server, and executes an RPC on the server). The RPC is also shown above. Before the line with the await keyword (which awaits a timer) the correct ID is shown, but after the await keyword the ID is incorrectly given as 0.
Now this is partially to be expected I'd say, the function to get this value depends on the method being called right now, and will be updated, it will no longer be valid after a delay
This should probably be documented, but there's no way to avoid this as it's a thing that's temporary
The documentation says:
Note: If not inside an RPC this method will return 0.
And this isn't obvious, but being inside an RPC in this case means it has to be the same time, without await, this should be documented more clearly
Tested versions
v4.2.1.stable.official.b09f793f5
System information
Godot v4.2.1.stable - Ubuntu 22.04.3 LTS 22.04 - X11 - GLES3 (Compatibility) - Mesa Intel(R) Graphics (RKL GT1) () - 11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz (16 Threads)
Issue description
In multiplayer, during a remote procedure call (RPC), I noticed that multiplayer.get_remote_sender_id() gives inconsistent results after a line with the 'await' keyword (or at least results that are unexpected to me.)
After a line with the await keyword, the result of multiplayer.get_remote_sender_id() is 0, instead of the actual remote sender ID. Before the line with the await keyword, it gives the sender ID just fine. It seems that after await, if forgets that it's in the rpc?
Maybe this is the expected behavior, but in that case it should maybe be added to the documentation?
Steps to reproduce
Start two instances of the MRP (below). In the first instance, click the server button (which starts a server). In the second, click the client button (which starts a client, connects to the server, and executes an RPC on the server). The RPC is also shown above. Before the line with the await keyword (which awaits a timer) the correct ID is shown, but after the await keyword the ID is incorrectly given as 0.
Minimal reproduction project (MRP)
MRP.zip
The text was updated successfully, but these errors were encountered: