Godot Version
4.4.1
Question
I’m working on a prototype for a multiplayer survival game in which the players can pick up items. My code only works on the server and I get the errors below. What am I doing wrong here? Doesn’t it suffice to free the Node on the server?
# in player.gd
if event.is_action_pressed("pick_up"):
get_viewport().set_input_as_handled()
if interaction_ray_cast.is_colliding():
var maybe_pick_up: Node = interaction_ray_cast.get_collider().owner.owner
if maybe_pick_up is PickUp:
maybe_pick_up.pick_up.rpc_id(1)
# in pick_up.gd
@rpc("any_peer", "call_local", "reliable")
func pick_up() -> void:
if multiplayer.is_server():
queue_free()
E 0:00:25:477 process_rpc: Invalid packet received. Requested node was not found.
<C++ Error> Parameter "node" is null.
<C++ Source> modules/multiplayer/scene_rpc_interface.cpp:212 @ process_rpc()
E 0:00:25:252 get_node: Node not found: "Game/Level/Objects/RockPickUp" (relative to "/root").
<C++ Error> Method/function failed. Returning: nullptr
<C++ Source> scene/main/node.cpp:1878 @ get_node()