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

Print an error when attempting to pass an Object or Callable through an RPC #92480

Open
Cliffsky opened this issue May 28, 2024 · 3 comments
Open

Comments

@Cliffsky
Copy link

Tested versions

Reproducible in 4.2.2

System information

Windows 11

Issue description

I'm trying to instantiate an object for host and client. Object takes in a custom resource and sets texture based on above resource on _ready. Since Multiplayer Synchronizer does not synchronize resources/objects, I moved _ready code block into an RPC setter function which will set the custom resource in the object (spawned across peers with Multiplayer Spawner) for all peers. The RPC setter takes in a resource as argument. Unexpected behavior resulted: stepping into RPC setter, the passed resource was "null" for client, but not for host, for whom the resource was populated as normal.

Steps to reproduce

  1. Spawn 2 instances in debug
  2. Click "Host" with 1st window. Click "Join" with 2nd window.
  3. Walk players so they face each other.
  4. Hit "Tab" to open inventory, click on any item to grab, hover grabbed item off inventory screen as if to place on level, hit RMB to spawn in level.
  5. Should trigger error.

Minimal reproduction project (MRP)

Relevant code is in _on_inventory_interface_drop_slot_data (spawns object) in world_debug.gd and set_slot_data in pick_up.gd
MRP.zip

@LunaCapra
Copy link
Contributor

The high level multiplayer documentation mentions in passing that

RPCs will not serialize objects or callables.

I believe resources fall under this criteria.

@Calinou
Copy link
Member

Calinou commented Jul 9, 2024

This is indeed not supported: #74443

Leaving this open, as we should figure out how to print runtime errors to indicate this.

By the way, does this also apply to Signal?

@Calinou Calinou changed the title Resource argument passed through RPC comes out as "null" on client Print an error when attempting to pass an Object or Callable through an RPC Jul 9, 2024
@LunaCapra
Copy link
Contributor

LunaCapra commented Jul 9, 2024

By the way, does this also apply to Signal?

From a quick test with a multiplayer.is_server() if statement, signals do seem to be serialized.
I tested this on 4.2.2 with C#

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants