I am making a 3D online mobile game in unity C#. I want the room to wait until everyone in the room to load the scene. I made a waiting UI for people who joined early but I can't find a clear way to cout the players who have things such as entered the scene without writing dirty code such as making a syncronized counter object. Can I send messages between objects without photonView in Unity C#?
I can't find a clear way to cout the players who have things such as entered the scene without writing dirty code such as making a syncronized counter object
From Master Client (PhotonNetwork.IsMasterClient
check), check the number of actors joined to the room whenever a new player joins (inside IInRoomCallbacks.OnPlayerEnteredRoom
callback, read about callbacks here). If the number matches the one you expect, load the level from the Master Client using the Photon method (PhotonNetwork.LoadLevel
, see reference API here) and not the default Unity method. All clients of other joined players will follow automatically.
Can I send messages between objects without photonView in Unity C#?
Yes. Use custom events via PhotonNetwork.RaiseEvent
. Read more about it here.