Closed asadm closed 1 month ago
Can we also add the snippet to keep players array in unity docs?
might be something like:
object[] players = Array.Empty<object>();
...
PlayroomKit.OnPlayerJoin((player) => {
players.push(player)
player.OnQuit(() => {
Debug.Log($"{player.id} quit!");
players.Where(p => p != player).ToArray();
});
})
Will get this done. Is there a better way we could/should handle Players @asadm ? Just wondering, we're currently maintaining it in three places.
(JS side, then Unity side, then Game side)
I've made a PR for docs (https://github.com/asadm/playroom-docs/pull/43).
@momintlh - Please make the method/field private, in a PR here.
There was a discussion in discord to use a List / Array instead of the dictionary but still keeping it public. So should I do that or just make it private for now?
Just private for now. We're providing docs to guide users.
We will revisit the idea of List / Array in another release.
Completed in #67
@asadm Is GetPlayers()
supposed to be private?
What happened?
People should just use OnPlayerJoin callback.
Version
0.0.20
What is your environment?
No response
Link to original discussion
No response
Relevant log output
No response