Update user ID through RPC

Options

I developed a server as host. And the clients join to its room.

Each client chooses a nick name ( which I call user ID). The nick name is set using an RPC ( I developed it using the same method as in Karts example).

The problem is that, when users join the room, their IDs do not get updated instantly. Rather, the update might take even several minutes.

Is this normal? This prevents the game logic to perform completely.

Please let me know what is wrong with my code.


Thanks


Here is the piece of code of the RPC:


[Networked] public string UniqueID { get; set; }

[Rpc(sources: RpcSources.InputAuthority, targets: RpcTargets.All, InvokeResim = true)]
private void RPC_SetPlayerStats(string uid, int role)
{
    UniqueID = uid;
    Role = (PlayersInfo.PlayerRole)role;
    this.gameObject.name = "PotentialMatch_" + uid + "_" + Role;
    Debug.Log($"uid: {uid}, role:{role}, was set to object of: {Object.InputAuthority}");
}


And I call this, in the Spawned() function, on the client side:


public override void Spawned()
{
    base.Spawned();
    if (Object.HasInputAuthority)
    {
        Local = this;
        RPC_SetPlayerStats(MatchMakingSystem.Instance.LocalPlayerId, 0);
    }
    PotentialMatchesDict.Add(Object.InputAuthority.ToString(), this);
    Debug.Log("Spawned: " + UniqueID);
}