PlayFlowLobbyManagerV2
uses a system of UnityEvent
s to communicate state changes and important occurrences to your game. By subscribing to these events, you can create a responsive UI and trigger game logic at the right moments.
All events are accessible through the PlayFlowLobbyManagerV2.Instance.Events
property, which is an instance of PlayFlowEvents
.
Subscribing to Events
You subscribe to events using the standardAddListener
method. It’s best practice to do this after the manager has been initialized.
Event Reference
Here is a complete list of events available onPlayFlowEvents
.
Lobby Events
Fired when a lobby is successfully created by the local player. The event passes the created
Lobby
object.
Argument: Lobby
Fired when the local player successfully joins a lobby.
Argument:
Lobby
Fired whenever the
Lobby
data changes. This can be due to players joining/leaving, player state changes, or host actions.
Argument: Lobby
Fired after the local player successfully leaves a lobby.
Argument:
void
Match Events
Fired for all players in a lobby when the host starts the match.
Argument:
Lobby
Fired when the match is running and connection info is available.
Argument:
ConnectionInfo
Fired for all players when the host ends the match.
Argument:
Lobby
Player Events
Fired for all players in a lobby when a new player joins. The
PlayerAction
contains the ID of the player who joined.
Argument: PlayerAction
Fired for all players in a lobby when another player leaves. The
PlayerAction
contains the ID of the player who left.
Argument: PlayerAction
System Events
Fired when the client successfully connects to the PlayFlow service.
Argument:
void
Fired when the client disconnects from the PlayFlow service.
Argument:
void
Fired when any error occurs within the SDK. Provides a string message describing the error.
Argument:
string