godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.12k stars 21.18k forks source link

Calling RPC function results in error even though the function being called is marked with @rpc #59704

Closed BoomerDev closed 2 years ago

BoomerDev commented 2 years ago

Godot version

4.0.alpha5

System information

Windows 10, Vulkan Clustered, GeForce RTX 2060

Issue description

I am working on a multiplayer prototype with Godot 4.0 alpha5, and I have run into an issue with the RPC system. I am using a client-server model, and on my client, I have this test function:

@rpc func some_function(): print("Test function called.")

and on my server I have this code:

func _on_peer_connected(pid: int): rpc_id(pid, "some_function")

All my Godot multiplayer knowledge is coming from 3.x, so maybe this could be a bug, or me just being stupid.

Steps to reproduce

none

Minimal reproduction project

No response

Edit: I forgot to note that the error I keep getting is this: 'Unable to get the RPC configuration for the function "some_function" at path: "/root/Network". This happens when the method is missing or not marked for RPCs in the local script.'

Calinou commented 2 years ago

@BoomerDev Please upload a minimal reproduction project to make this easier to troubleshoot.

Noiros commented 2 years ago

Same problem here, if you send a rpc with out arg like : rpc(&"testfunc")

renacava commented 2 years ago

try putting @rpc before any functions that contain an rpc_id().

Faless commented 2 years ago

Likely a duplicate of #59939 / https://github.com/godotengine/godot/issues/59972#issuecomment-1091971779

Faless commented 2 years ago

Closing in favor of #59939 which has more details.