It seems a fairly standard setup that every time a client joins the server, the server will create a Player ghost, which will cause a ghost to be created on all connected clients.
I want to detect on client1 when client2 ghost is created and execute some code at that point.
The simplest solution seems to be having a CommponentSystem update loop to count the number of Player ghosts at all times and detect any changes in count, but…
Does anyone know of a way that the client can detect when a new Player ghost is created, more like an event, rather than having to constantly check for changes by querying in the update loop?
I’ve made it so that when a Player ghost is first created on client, I add a “PlayerJoined” tag
I then query for any player with the “PlayerJoined” tag in the update loop, and check for when the ghost actually starts to receive snapshots because I’ve found there are at least a couple frames where the player ghost is created, but not receiving any snapshots, even in local testing.
Once snapshots are verified as being received, I remove the “PlayerJoined” tag and add the “PlayerActive” tag, which should be the final state of the player.