[UNITY] I using broadcast(bc) but server only bc to 1 client itselft
-
SERVER CODE
onCreate (options: any) {this.setState(new State()); this.setMetadata({ str: "hello", number: 10 }); this.setPatchRate(1000 / 20); this.setSimulationInterval((dt) => this.update(dt)); this.onMessage("cl_move_right", (client) => { const p = this.state.players[client.sessionId]; this.broadcast("sv_move_right", p ); }) }
// CLIENT (UNITY)
room.OnMessage<Player>("sv_move_right", (plaayer) =>
{
Debug.Log(player);
inputText.text += "__" + player.sessionId;
});
-
@lqvinh2 said in [UNITY] I using broadcast(bc) but server only bc to 1 client itselft:
SERVER CODE
onCreate (options: any) {this.setState(new State()); this.setMetadata({ str: "hello", number: 10 }); this.setPatchRate(1000 / 20); this.setSimulationInterval((dt) => this.update(dt)); this.onMessage("cl_move_right", (client) => { const p = this.state.players[client.sessionId]; this.broadcast("sv_move_right", p ); }) }
// CLIENT (UNITY)
void RegisterRecMess()
{
room.OnMessage<Player>("sv_move_right", (plaayer) =>
{
Debug.Log(player);
inputText.text += "__" + player.sessionId;
});
}async void OnMoveRight() { await room.Send("cl_move_right"); }