Search code examples
rpcmultiplayergodot

Godot multplayer RPC node tree issues?


Hey guys i seem to be having an issue with the RPC API.

I've read that node paths need to be identical and I believe I have achieved this but I'm still having issues?

The server should be able to RPC to the client but it still doesn't work.

globals.net_player.set_name(str(get_tree().get_network_unique_id()))
globals.net_player.set_network_master(get_tree().get_network_unique_id())



add_child(globals.net_other_player)
add_child(globals.net_player)

RPC Issue #1


Solution

  • the rpc() call needs to come from the same location as the rpc it is targeting.

    extends Node2D
    slave func set_name(name):
    
        pass
    
    func set_name_rpc(name):
        rpc("set_name", name)
        pass