I already have many room and client can connected to every room, now in unity i want to create new Scene. But i dont know how to match client join Scene exactly which client choose.
Please give some recommanded thing to do this
thank all.
I already have many room and client can connected to every room, now in unity i want to create new Scene. But i dont know how to match client join Scene exactly which client choose.
Please give some recommanded thing to do this
thank all.
@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");
}
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;
});