RPC call to remote func not work for slaves

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Delphinum
func onConnected():
    rpc("registerPlayer", get_tree().get_network_unique_id())

remote func registerPlayer(id):
    print(id)

call only server, not slaves. This is a bug? I can give Git repository for repeat this problem.

Godot ver. 3.2
OS Ubuntu 16.04

:bust_in_silhouette: Reply From: zdimaria

Change your function to:

sync func registerPlayer(id):

The issue is that remote is called only from other boxes, while sync will also call it on the current. Its not necessarily a master vs slave issue.

The issue is that remote is called only from other boxes
My remote func is not called in other boxes, only server. It works like master keyword and i understand why?

Delphinum | 2018-03-17 08:30

:bust_in_silhouette: Reply From: hilfazer

I assume your onConnected() function is connected to connected_to_server signal.
This signal is called after peer connects to server but before it connects to any other peer.

Try connecting some function to network_peer_connected signal of SceneTree. It will be called once per peer you’re connecting with. It’s called for server as well.

Another option is to register new player on server and make server inform eveyone that new guy has joined.

I assume your onConnected() function is connected to
connected_to_server signal.
Yes it is.

This signal is called after peer connects to server but before it
connects to any other peer.
I did not know this, thx!

Delphinum | 2018-03-17 08:34