NetworkManager
Jump To Parameters
Jump To Delegates
Jump To Function Definitions
Parameter Definitions
Select the parameter name from below to jump directly to it on this page.
_connectStatus
_connecting
_currentLevelIndex
allowTeamDamaging
autoSpawnPlayer
cachedRoomList
connect_attempts
database
debugging
defaultSpawnPoint
displayDebugWindow
gameVersion
initalTeamSpawnPointNames
lobbyEvents
maxPlayerPerRoom
otherEvents
playerEvents
playerPrefab
reconnect
replayScenes
roomEvents
spawnAtSaved
spawnPointsTag
syncScenes
teamName
voiceRecorder
_connectStatus
Shows the current connection process. This is great for UI to reference and use.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | string | ”” |
_connecting
Says if you’re currently connecting to the Photon Server, Lobby, or Room. (false after connection is made)
| Exposed Value | Type | Default Value |
|---|---|---|
| public | bool | false |
_currentLevelIndex
The current index of the Unity scene that your currently in. This is used for internal “
logic in the NetworkManager and ChatBox.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | int | -1 |
allowTeamDamaging
Allow team members to damage each other.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | bool | false |
autoSpawnPlayer
If you want to immediately spawn the player into the scene when joining the lobby. “
If not you need to have a UI that sets this to true before going to the next scene.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | bool | true |
cachedRoomList
The current photon room list if in the photon lobby. This is updated via the “
"UpdateCachedRoomList" function which in turn is called via the "OnRoomListUpdate" “
function.
| Exposed Value | Type | Default Value |
|---|---|---|
| None | RoomInfo> | new Dictionary<string, RoomInfo>() |
connect_attempts
How many attempts to reconnect to the room if ‘reconnect’ is true.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | int | 3 |
database
The scene database that holds all of the information about all of the given scenes.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | SceneDatabase | null |
debugging
If you want to log everything to the console that the network manager is doing at runtime.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | bool | false |
defaultSpawnPoint
The point where the player will start when they have successfully connected or if no other available spawn point is specified.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | Transform | null |
displayDebugWindow
If you want to display a visual window of the current settings found in the network manager at runtime.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | bool | false |
gameVersion
The version to connect with. Incompatible versions will not connect with each other.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | string | “1.0” |
initalTeamSpawnPointNames
The spawn point name that will represent the initial starting point for the team “
If more than one of the spawn points are named with this same name then it will randomly “
choose between those points and spawn the team member at that location.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | DictionaryOfStringAndString | new DictionaryOfStringAndString() |
lobbyEvents
Actions to trigger on events that happen in the lobby. Contains the following UnityEvents: “
_onJoinedLobby, _onLeftLobby
| Exposed Value | Type | Default Value |
|---|---|---|
| public | LobbyEvents | None |
maxPlayerPerRoom
The max number of player per room. When a room is full, it can’t be joined by new players, and so a new room will be created.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | byte | 4 |
otherEvents
Unity events to call based on Misc Network events. This contains the following UnityEvent parameters: “
_onMasterClientSwitched, _onDisconnected, _onConnectedToMaster, _onFailedToConnectToPhoton, _onConnectionFail
| Exposed Value | Type | Default Value |
|---|---|---|
| public | OtherEvents | None |
playerEvents
Actions to trigger on events that happen with actions according to each player. This contains “
the following UnityEvent parameters: _onPlayerEnteredRoom, _onPlayerLeftRoom
| Exposed Value | Type | Default Value |
|---|---|---|
| public | PlayerEvents | None |
playerPrefab
The _prefab that will be spawned in when a player successfully connects.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | GameObject | null |
reconnect
Automatically attempt to reconnect to the last room you were in if you get disconnected.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | bool | false |
replayScenes
Save state between scenes. When you re-enter the scene replay all of the actions on the objects with syncScenes enabled. “
This allows for persistant dropped items, picked up items, interacted objects, etc. between unity scenes/photon rooms.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | bool | true |
roomEvents
Actions to trigger on events that happen in the room. Contains the following UnityEvents: “
_onJoinedRoom, _onLeftRoom, _OnCreatedRoom, _onCreateRoomFailed, _onJoinRoomFailed, _onReconnect
| Exposed Value | Type | Default Value |
|---|---|---|
| public | RoomEvents | None |
spawnAtSaved
On a successfull reconnect, do you want to spawn the character back at the location “
you last were at or just at a random spawn in point?
| Exposed Value | Type | Default Value |
|---|---|---|
| public | bool | true |
spawnPointsTag
Will find all transforms with this tag and treat it as a spawn point. If no tag is specified will only us what is placed in the default spawn point tag.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | string | “SpawnPoint” |
syncScenes
Automatically sync all connected clients scenes. Make sure everyone is always on the same scene together.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | bool | false |
teamName
The name of the team you’re currently on. If the team name is never set either manually or “
via the "SetTeamName" function everyone will be able to damage each other. (Free-For-All) “
\n\nWARNING: DO NOT SET THIS MANUALLY! “
The only reason to set this manually is if you are testing something out related to same “
team mechanics.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | string | ”” |
voiceRecorder
The voice recorder that will be set on owning players Primary Recorder slot. This must be set if using voice chat.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | Recorder | None |
Delegate Definitions
Select the delegate name from below to jump directly to it on this page.
OnClientHostSwitched
OnConnectedToMasterPhotonServer
OnConnectionFailed
OnCreateRoomFailure
OnCreatedPhotonRoom
OnDisconnectedFromPhoton
OnFailToConnectToPhoton
OnJoinRoomFailure
OnJoinedChatDataChannel
OnJoinedPhotonLobby
OnJoinedPhotonRoom
OnLeftPhotonLobby
OnLeftPhotonRoom
OnPlayerJoinedCurrentRoom
OnPlayerKicked
OnPlayerLeftCurrentRoom
OnReconnectingToRoom
OnUpdatedRoomList
public PlayerDelegate OnClientHostSwitched
This delegate is called whenever the master client left and a new master client is selected.
| Parameter Name | Description |
|---|---|
| player | player parameter is Photon.Realtime.Player type. This is the player was selected as the master client. |
public BasicDelegate OnConnectedToMasterPhotonServer
This delegate is called when you successfully connect to the photon master server.
No parameters
public DisconnectCauseDelegate OnConnectionFailed
This delegate is called when something causes the connection to fail(after it was established), followed by a call to OnDisconnectedFromPhoton(). If the server could not be reached in the first place, OnFailedToConnectToPhoton is called instead.The reason for the error is provided as StatusCode.
| Parameter Name | Description |
|---|---|
| cause | cause parameter is Photon.Realtime.DisconnectCause type. This is a basic connection error/cause that is returned. |
public RoomFailure OnCreateRoomFailure
This delegate is called whenever you failed to create to a photon room.
| Parameter Name | Description |
|---|---|
| returnCode | The status code |
| message | A basic error message. |
public BasicDelegate OnCreatedPhotonRoom
This delegate is called when you successfully create a the photon room.
No parameters
public DisconnectCauseDelegate OnDisconnectedFromPhoton
This delegate is called whenever you disconnect from the photon room.
| Parameter Name | Description |
|---|---|
| cause | cause parameter is Photon.Realtime.DisconnectCause type. This is a basic disconnect error that is returned. |
public DisconnectCauseDelegate OnFailToConnectToPhoton
This delegate is called when something causes the connection to the Photon master server to fail.
| Parameter Name | Description |
|---|---|
| cause | cause parameter is Photon.Realtime.DisconnectCause type. This is a basic connection error/cause that is returned. |
public RoomFailure OnJoinRoomFailure
This delegate is called whenever you failed to connect to a photon room.
| Parameter Name | Description |
|---|---|
| returnCode | The status code |
| message | A basic error message. |
public StringDelegate OnJoinedChatDataChannel
This delegate is called when you successfully connected to the ChatBox’s data channel.
No parameters
public BasicDelegate OnJoinedPhotonLobby
This delegate is called when you successfully connect to the photon lobby.
No parameters
public BasicDelegate OnJoinedPhotonRoom
This delegate is called when you successfully connect to the photon room.
No parameters
public BasicDelegate OnLeftPhotonLobby
This delegate is called when you successfully disconnect from the photon lobby.
No parameters
public BasicDelegate OnLeftPhotonRoom
This delegate is called when you successfully disconnect from the photon room.
No parameters
public PlayerDelegate OnPlayerJoinedCurrentRoom
This delegate is called whenever another player joins the photon room. This isn’t called when you first join on yourself.
| Parameter Name | Description |
|---|---|
| player | player parameter is Photon.Realtime.Player type. This is the player that is joining. |
public PlayerDelegate OnPlayerKicked
This delegate is called whenever another player is kicked from the photon room.
| Parameter Name | Description |
|---|---|
| player | player parameter is Photon.Realtime.Player type. This is the player that was just kicked from the photon room. |
public PlayerDelegate OnPlayerLeftCurrentRoom
This delegate is called whenever another player leaves the photon room. This isn’t called when you leave the photon room on yourself.
| Parameter Name | Description |
|---|---|
| player | player parameter is Photon.Realtime.Player type. This is the player that is leaving. |
public BasicDelegate OnReconnectingToRoom
This delegate is called whenever you are trying to reconnect to a room after you disconnected from it.
No parameters
public RoomListUpdate OnUpdatedRoomList
This delegate is called a update to the photom room list is received.
| Parameter Name | Description |
|---|---|
| roomList | roomList is type Dictionary<string, RoomInfo>. A list of currently found photon rooms. |
Function Definitions
Select the function name from below to jump directly to it on this page.
Awake
ConnectToMasterServer
CreateItem
CreateRoom
Disconnect
DoSceneReplay
GetCachedPlayerData
GetChabox
GetChatDataChannel
GetCurrentSceneIndex
GetCurrentSceneName
GetGlobalRoomName
GetIndividualRoomName
GetPlayerCount
GetRandomSpawnPoint
GetTeamSpawnPoint
GetYourPlayer
IsInLobby
IsInRoom
ItemListTheSame
JoinChatDataChannel
JoinLobby
JoinOrCreateRoom
JoinRandomRoom
JoinRoom
KickPlayer
KickPlayer
LeaveLobby
LeaveRoom
LoadPlayerData
NetworkInstantiatePersistantPrefab
NetworkInstantiatePrefab
NetworkLoadLevel
NewSceneLoaded
OnConnectedToMaster
OnConnectionFail
OnCreateRoomFailed
OnCreatedRoom
OnDisconnected
OnFailedToConnectToPhoton
OnJoinRandomFailed
OnJoinRoomFailed
OnJoinedLobby
OnJoinedRoom
OnLeftLobby
OnLeftRoom
OnMasterClientSwitched
OnPlayerEnteredRoom
OnPlayerLeftRoom
OnRoomListUpdate
ReplaySceneDatabase
SavePlayer
SetInDataChannel
SetPlayerName
SetRoomIsOpen
SetRoomVisibility
SetSpawnAtPoint
SetTeamName
Start
UpdateCachedRoomList
UpdateSceneDatabase
protected virtual void Awake()
This is used to make sure this is the only NetworkManager in the scene as well as setup scene loading delegates
| Expose Value | Overrideable | Returns |
|---|---|---|
| protected | True | Does not return anything |
No parameters
public virtual void ConnectToMasterServer()
Connect to the PUN master server.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
private void CreateItem(ObjectAction item)
Used by the DoSceneReplay funcion only, do not modify. This is responsible for creating items in the Unity scene.
| Expose Value | Overrideable | Returns |
|---|---|---|
| private | False | Does not return anything |
| Parameter Name | Description |
|---|---|
| item | The ObjectAction item to create. |
public virtual void CreateRoom(string roomName, RoomOptions options = null, ExitGames.Client.Photon.Hashtable customRoomProperties = null, string[] exposePropertiesToLobby = null)
Create a room with the target name for other players to join in the default lobby. Will connect to master server and default lobby if not already connected.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| roomName | The name of the room to make |
| options | Options for the room, in case it does not exist yet. Else these values are ignored. |
| customRoomProperties | The room properties to potentially create this room with |
| exposePropertiesToLobby | The custom properties you want to allow other users to see |
public virtual void Disconnect()
Disconnect from the PUN master server. Will be dropped from any lobby or room.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
private void DoSceneReplay(bool createsOnly = false, bool updatesOnly = false)
Performs all the actions on this scene that have been stored in the scene database. Actions are received via the Chatbox’s data channel. When someone opens a door, presses a button, drops an item, picks up an item, etc. In another scene that information is recieved by everyone in the session via the ChatBox’s data channel. This function is responsible to replay all of those actions for a particular scene when you enter the unity scene. That way it is in sync with all of the other players that are currently already in the scene. This also deals with keeping Unity scenes persistant between loads.
| Expose Value | Overrideable | Returns |
|---|---|---|
| private | False | Does not return anything |
| Parameter Name | Description |
|---|---|
| createsOnly | Only perform the creates actions? (ex: Dropped items) |
| updatesOnly | Only perform the updates actions? (ex: opened doors/pressed buttons) |
public virtual PlayerData GetCachedPlayerData()
Get the PlayerData that was saved previously. Used for loading saved player stats, inventory, etc.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | cached player data |
No parameters
public virtual ChatBox GetChabox()
Get the chatbox component.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | The chatbox component |
No parameters
public virtual string GetChatDataChannel()
Get the current chatbox’s data channel.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Chatbox’s data channel that you’re subscribed to. |
No parameters
public virtual int GetCurrentSceneIndex()
Get the scene index that the network manager thinks it’s in.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Scene index, int |
No parameters
public virtual string GetCurrentSceneName()
Get the scene name that the network manager thinks it’s in.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | The network manager scene name string |
No parameters
public virtual string GetGlobalRoomName(string inputName)
Will format the string to be session name compliant.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | The session name. |
| Parameter Name | Description |
|---|---|
| inputName | The name that you want to make sure is session name formatted. |
public virtual string GetIndividualRoomName()
Gets the current session name that your in and combines it with the Unity scene that your in to make it (session name)_(unity scene)
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | A string formatted like: (session name)_(unity scene) |
No parameters
public virtual int GetPlayerCount()
Returns the numbers of players connected to this room
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | The number of players currently in the photon room |
No parameters
public virtual Transform GetRandomSpawnPoint()
Returns a random transform from the scene that is tagged with the spawn point tag.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Transform that is tagged with the specified spawn point tag. |
No parameters
public virtual Transform GetTeamSpawnPoint(string teamName)
Get a spawn point that is specific for the specified team.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Transform that is tagged with spawn point tag but is also named according to your team definition. If nothing like this is found then GetRandomSpawnPoint() is called. |
| Parameter Name | Description |
|---|---|
| teamName | The specific team named spawn point to look for. |
public virtual vThirdPersonController GetYourPlayer()
Get the vThirdPersonController that you own, not the networked players.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | vThirdPersonController component |
No parameters
public virtual bool IsInLobby()
Are you currently in a photon lobby?
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | True if you’re already in a photon lobby |
No parameters
public virtual bool IsInRoom()
Are you currently in a photon room?
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | True if you’re already in a photon room. |
No parameters
private bool ItemListTheSame(List original, List incoming)
Used by the DoSceneReplay function only, do not modify. This is responsible for building the information array. The is used by the DoSceneReplay function, do not modify. This is used to make sure that the item list on a particular item is the same for the entering player.
| Expose Value | Overrideable | Returns |
|---|---|---|
| private | False | True or False if the item list is currently the same. |
| Parameter Name | Description |
|---|---|
| args | *No found decription |
| original | The current item list |
| incoming | The proposed update list |
protected virtual void JoinChatDataChannel()
Subscribe to the ChatBox’s data channel based on the GetGlobalRoomName function.
| Expose Value | Overrideable | Returns |
|---|---|---|
| protected | True | Does not return anything |
No parameters
public virtual void JoinLobby(TypedLobby lobbyType = null)
Join the default lobby. If not connected will connect to master server first. If already in lobby, will do nothing.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| lobbyType | A typed lobby to join (must have name and type). |
public virtual void JoinOrCreateRoom(string roomName, RoomOptions options = null, ExitGames.Client.Photon.Hashtable customRoomProperties = null, string[] exposePropertiesToLobby = null, string[] expectedUsers = null)
Attempts to join the selected room. If it doesn’t exist it will create it.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| roomName | The name of the room to join/create |
| options | Options for the room, in case it does not exist yet. Else these values are ignored. |
| customRoomProperties | The room properties to potentially create this room with |
| exposePropertiesToLobby | The custom properties you want to allow other users to see |
| expectedUsers | Optional list of users (by UserId) who are expected to join this game and who you want to block a slot for. |
public virtual void JoinRandomRoom(ExitGames.Client.Photon.Hashtable expectedRoomProperties = null)
Attempt to join a random room in your connected lobby. Will join master server and defaul lobby if not already connected prior to joining.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| expectedRoomProperties | The room properties that need to exist for you to join the room |
public virtual void JoinRoom(string roomName)
Join a room with name in your connected lobby. Will join master server and defaul lobby if not already connected prior to joining.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| roomName | The name of the photon room to join |
public virtual void KickPlayer(Photon.Realtime.Player playerToKick)
Boots a player from a photon room.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| playerToKick | The Photon.Realtime.Player to kick from the photon room |
public virtual void KickPlayer(string userId)
Boots a player from a photon room.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| userId | The UserId to kick from the photon room. |
public virtual void LeaveLobby()
Leave your currently connected lobby but stay connect to the master server.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public virtual void LeaveRoom()
Makes the caller leave the room they are connected to but stay connected to default lobby and master server.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public virtual void LoadPlayerData(string playerName, vThirdPersonController player = null, bool useSavedNickname = true, bool loadFromCache = false, bool overrideStartMaxHealth = false)
Load the player data into the target vThirdPersonController.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| playerName | The player name the data is cached under |
| player | The vThirdPersonController you want to load the data into |
| useSavedNickname | If you don’t want to overwrite the saved player name |
| loadFromCache | If you want to load what the NetworkManager already knows about or load it from the saved binary file |
| overrideStartMaxHealth | If you want to set the health to whatever is loaded |
public virtual GameObject NetworkInstantiatePersistantPrefab(string prefabName, Vector3 position, Quaternion rotation, byte group = 0, object[] data = null)
Spawn a object from the “Resources” folder on every instance of the game over the network that is owned by the scene, no player.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | spawned Gameobject from the resource folder |
| Parameter Name | Description |
|---|---|
| prefabName | The name of the prefab in the resource folder |
| position | Vector3 position in the scene to spawn the object |
| rotation | Quaternion rotation in the scene to spawn the object |
| group | The network group to do this for |
| data | Additional data to spawn the object with |
public virtual GameObject NetworkInstantiatePrefab(string prefabName, Vector3 position, Quaternion rotation, byte group=0, object[] data=null)
Spawn a object from the “Resources” folder on every instance of the game over the network that is owned by a particular player
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | spawned Gameobject from the resource folder |
| Parameter Name | Description |
|---|---|
| prefabName | The name of the prefab in the resource folder |
| position | Vector3 position in the scene to spawn the object |
| rotation | Quaternion rotation in the scene to spawn the object |
| group | The network group to do this for |
| data | Additional data to spawn the object with |
public virtual void NetworkLoadLevel(int level, string spawnAtPoint = null, bool sendEveryone = false)
Loads a Unity Scene and triggers creating or joining a room based on the GetIndividualRoomName function’s return. Can send one person or everyone together. If everyone only the MasterClient can do this. Calling this also saves the current settings of your player and restores them in the new unity scene when it has spawned your player there.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| level | The index of the unity scene to load |
| spawnAtPoint | The string of the spawn point to find and spawn your character at |
| sendEveryone | Send everyone in the current photon room with you to the new scene. |
public virtual void NewSceneLoaded(Scene scene, LoadSceneMode mode)
Callback method that is called every time a new scene is loaded. Will potentially spawn your character in the new scene. It also replays the items that were dropped/picked up in this scene as well as other network actions.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| scene | The scene that is getting loaded. |
| mode | LoadSceneMode that is loading this scene. |
public override void OnConnectedToMaster()
Callback method. Called when you connect to the photon master server.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public virtual void OnConnectionFail(DisconnectCause cause)
Callback Method. Called when you fail to connect to a Photon Room/Lobby. Calls the otherEvents._onConnectionFail UnityEvent and OnConnectionFailed delegate.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| cause | DisconnectCause with a basic error message. |
public override void OnCreateRoomFailed(short returnCode, string message)
Callback method. called when you fail to create a photon room. This also triggers the roomEvents._onCreateRoomFailed UnityEvent and the OnCreateRoomFailure delegate.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| returnCode | The error code |
| message | Simple error message |
public override void OnCreatedRoom()
Callback method. Called when you have successfully create a photon room. Calls JoinChatDataChannel function, roomEvents._OnCreatedRoom UnityEvent, and OnCreatedPhotonRoom delegate.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public override void OnDisconnected(DisconnectCause cause)
Callback method. Called when you disconnect from a photon room. Calls the otherEvents._onDisconnected UnityEvent and OnDisconnectedFromPhoton delegate.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| cause | DisconnectCause with a basic error message. |
public virtual void OnFailedToConnectToPhoton(DisconnectCause cause)
Callback method. Called when you fail to connect to the photon master server. Calls the otherEvents._onFailedToConnectToPhoton UnityEvent and OnFailToConnectToPhoton delegate.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| cause | DisconnectCause with a basic error message. |
public override void OnJoinRandomFailed(short returnCode, string message)
Callback method. Called when you fail to join a random photon room. Calls the roomEvents._onJoinRoomFailed UnityEvent and OnJoinRoomFailure delegate.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| returnCode | The error code |
| message | Simple error message |
public override void OnJoinRoomFailed(short returnCode, string message)
Callback method. Called when you fail to join a specified room. Calls the OnJoinRoomFailure delegate and roomEvents._onJoinRoomFailed UnityEvent. If the return code is 32758 (timeout) it will attempt to recreate the room.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| returnCode | The error code |
| message | Simple error message |
public override void OnJoinedLobby()
Callback method. Called when successfully joined the photon lobby. Calls lobbyEvents._onJoinedLobby UnityEvent and OnJoinedPhotonLobby delegate. Will also call JoinRandomRoom, JoinRoom, or CreateRoom based on if you’re switching UnityScenes and attempting to join a Photon room or not.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public override void OnJoinedRoom()
Callback method. Calls JoinChatDataChannel and NetworkInstantiatePrefab functions. Calls OnJoinedPhotonRoom delegate and roomEvents._onJoinedRoom UnityEvent.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public override void OnLeftLobby()
Callback method. Called when you have succesfully left the Photon Lobby. Calls lobbyEvents._onLeftLobby UnityEvent and OnLeftPhotonLobby delegate.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public override void OnLeftRoom()
Callback method. Called when you have left a photon room. Calls the JoinRoom function or CreateRoom function if switching Unity scenes. Calls roomEvents._onLeftRoom UnityEvent and OnLeftPhotonRoom delegate.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public override void OnMasterClientSwitched(Photon.Realtime.Player newMasterClient)
Callback method. Callwed when the photon master client is switched.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| newMasterClient | The Photon.Realtime.Player that is now the new master client |
public override void OnPlayerEnteredRoom(Photon.Realtime.Player newPlayer)
Callback method. Called when another player enters the photon room. Isn’t called for yourself.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| newPlayer | The Photon.Realtime.Player that just entered the room. |
public override void OnPlayerLeftRoom(Photon.Realtime.Player otherPlayer)
Callback method. Called when a player leaves a room. Isn’t called for yourself.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| otherPlayer | The Photon.Realtime.Player that just left |
public override void OnRoomListUpdate(List roomList)
Callback method. Called when in a photon lobby and the number of photon rooms changes. Calls UpdateCachedRoomList.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| roomList | *No found decription |
public virtual void ReplaySceneDatabase(bool createsOnly = false, bool updatesOnly = false)
Triggers the WaitForReplay IEnumerator which triggers DoSceneReplay function.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| createsOnly | Only perform the creates actions? (ex: Dropped items) |
| updatesOnly | Only perform the updates actions? (ex: opened doors/pressed buttons) |
public virtual void SavePlayer(vThirdPersonController player)
Save your players stats, inventory, etc.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| player | The vThirdPersonController that you own and want to save. |
public virtual void SetInDataChannel(bool value)
Set if you are currently joined to the chatbox’s data channel or not
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| value | True or False, are you in the chatbox’s data channel? |
public virtual void SetPlayerName(string name = “”)
Set the players network name, if nothing is supplied will auto name as ‘Un-named Player’
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| name | The name you want to be known as over the network |
public virtual void SetRoomIsOpen(bool isOpen)
Set the current photon room as open and joinable
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| isOpen | True or false, Make the room open or not |
public virtual void SetRoomVisibility(bool isVisible)
The current photon room will be listed or not
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| isVisible | Room should be listed? |
public virtual void SetSpawnAtPoint(string pointName)
Set the spawn at point then trigger the “NewSceneLoaded” function.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| pointName | The spawn point name to set |
public virtual void SetTeamName(string inputName)
Set the name of the team you are a member of. This is for your local player only and is not designed to work with Network players.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| inputName | The team name to set. |
protected virtual void Start()
This is used to find the chatbox in the scene. Used in start to give awake enough time to destroy duplicate Chatbox’s if any.
| Expose Value | Overrideable | Returns |
|---|---|---|
| protected | True | Does not return anything |
No parameters
protected virtual void UpdateCachedRoomList(List roomList)
This is called via “OnRoomListUpdate” function. This will update the list of available rooms and store it in the cachedRoomList parameter. Only usable when in the Photon Lobby
| Expose Value | Overrideable | Returns |
|---|---|---|
| protected | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| roomList | List of current photon rooms. |
public virtual void UpdateSceneDatabase(ObjectAction hashData)
This is used to add/remove actions to be performed by the DoSceneReplay function. The scene database is responsible for playing actions for a player that is entering a Unity scene for the first time. This function will add or remove actions to the scene database.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| hashData | The data that defines what action to do and if to remove or add it |