---
description: This is just a test
---

# Triggers

The **Photon** module comes with a set of **Igniters or Triggers** that are called when when photon events happens like On Connected, On Joined Room etc.

## On Connection Events

This event handle pretty much all Photon Events. Some of them like:

* **OnConnected**: Called to signal that the "low level connection" got established but before the client can call operation on the server.
* **OnConnectedToMaster**: Called when the client is connected to the Master Server and ready for matchmaking and other tasks.
* **OnDisconnected**: Called after disconnecting from the Photon server. It could be a failure or an explicit disconnect call

![](https://3895715781-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LDchaEIEhpBAh2gCe06%2F-MKMhPgEevrLE-kkjvoo%2F-MKMk48AswyzdxeEk9O2%2Fimage.png?alt=media\&token=6fc1bf6c-1a76-4a78-997d-c982d28ae2e2)

## On Connection State

This event it's called when the Photon Network connection state changes and also store the current state in a local or global variable.

![](https://3895715781-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LDchaEIEhpBAh2gCe06%2F-MKMhPgEevrLE-kkjvoo%2F-MKMkbjJdFsZn_ccn5pC%2Fimage.png?alt=media\&token=942104c0-07c2-48ad-93fa-f10a0ee55012)

## On Photon Matchmaking

This trigger contains all Photon Matchmaking related events

* **OnLeftRoom**: Called when the local user/client left a room.
* **OnCreatedRoom**: Called when this client created a room and entered it. _OnJoinedRoom_ will be called as well.
* **OnJoinedRoom**: Called when entering a room (by creating or joining it). Called on all clients (including the Master Client).
* **OnCreateRoomFailed:** Called when the server couldn't create a room (OpCreateRoom failed).
* **OnJoinRoomFailed:** Called when a previous OpJoinRoom call failed on the server.
* **OnJoinRandomFailed:** Called when a previous OpJoinRandom call failed on the server.
* **OnFriendListUpdate:** Called when the server sent the response to a FindFriends request.

![](https://3895715781-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LDchaEIEhpBAh2gCe06%2F-MKMhPgEevrLE-kkjvoo%2F-MKMid_2nJmzCD9ycDdo%2Fimage.png?alt=media\&token=ce4f7dd3-35b0-472e-9f0c-f5420f3c953f)

## On Room Events

This trigger contains all Photon Room related events:

* **OnPlayerEnteredRoom:** Called when a remote player entered the room. This Player is already added to the playerlist.
* **OnPlayerLeftRoom:** Called when a remote player left the room or became inactive. Check otherPlayer.IsInactive.
* **OnMasterClientSwitched:** Called after switching to a new MasterClient when the current one leaves.

![](https://3895715781-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LDchaEIEhpBAh2gCe06%2F-MKMhPgEevrLE-kkjvoo%2F-MKMm7cfva5YJgEmyFTW%2Fimage.png?alt=media\&token=c256e717-71ce-40ca-8c9b-ca76bda2c4e9)
