Property | Type | Description | |
---|---|---|---|
MAX_VIEW_IDS | int | ||
PrefabCache | GameObject>.Dictionary | ||
UsePrefabCache | bool | ||
logLevel | PhotonLogLevel | ||
precisionForFloatSynchronization | float | ||
precisionForQuaternionSynchronization | float | ||
precisionForVectorSynchronization | float |
Property | Type | Description | |
---|---|---|---|
AllocateSceneViewIDs | int[] | ||
AllocateViewID | int | ||
Connect | void | ||
ConnectUsingSettings | void | ||
InitializeSecurity | void | ||
PhotonNetwork | System | ||
RPC | void | ||
RPC | void | ||
VerifyCanUseNetwork | bool |
Method | Description | |
---|---|---|
AllocateViewID ( ) : int |
Allocates a viewID that's valid for the current/local player.
|
|
CloseConnection ( PhotonPlayer, kickPlayer ) : void |
Request a client to disconnect (KICK). Only the master client can do this.
|
|
Connect ( string serverAddress, int port, string appID, string gameVersion ) : void |
Connect to the photon server by address, port, appID and game(client) version. This method is used by ConnectUsingSettings which applies values from the settings file. To connect to the Photon Cloud, a valid AppId must be in the settings file (shown in the Photon Cloud Dashboard). https://cloud.exitgames.com/dashboard Connecting to the Photon Cloud might fail due to: - Network issues (calls: OnFailedToConnectToPhoton()) - Invalid region (calls: OnConnectionFail() with DisconnectCause.InvalidRegion) - Subscription CCU limit reached (calls: OnConnectionFail() with DisconnectCause.MaxCcuReached. also calls: OnPhotonMaxCccuReached()) More about the connection limitations: http://doc.exitgames.com/photon-cloud/ |
|
ConnectUsingSettings ( string gameVersion ) : void |
Connect to the configured Photon server: Reads PhotonNetwork.serverSettingsAssetPath and connects to cloud or your own server. The PUN Setup Wizard stores your appID in a settings file and applies a server address/port. This is used for Connect(string serverAddress, int port, string appID, string gameVersion). To connect to the Photon Cloud, a valid AppId must be in the settings file (shown in the Photon Cloud Dashboard). https://cloud.exitgames.com/dashboard Connecting to the Photon Cloud might fail due to: - Network issues (calls: OnFailedToConnectToPhoton()) - Invalid region (calls: OnConnectionFail() with DisconnectCause.InvalidRegion) - Subscription CCU limit reached (calls: OnConnectionFail() with DisconnectCause.MaxCcuReached. also calls: OnPhotonMaxCccuReached()) More about the connection limitations: http://doc.exitgames.com/photon-cloud |
|
CreateRoom ( string roomName ) : void |
Creates a room with given name but fails if this room is existing already. If you don't want to create a unique room-name, pass null or "" as name and the server will assign a roomName (a GUID as string). Call this only on the master server. Internally, the master will respond with a server-address (and roomName, if needed). Both are used internally to switch to the assigned game server and roomName. PhotonNetwork.autoCleanUpPlayerObjects will become this room's AutoCleanUp property and that's used by all clients that join this room. |
|
CreateRoom ( string roomName, bool isVisible, bool isOpen, int maxPlayers ) : void |
Creates a room with given name but fails if this room is existing already. If you don't want to create a unique room-name, pass null or "" as name and the server will assign a roomName (a GUID as string). Call this only on the master server. Internally, the master will respond with a server-address (and roomName, if needed). Both are used internally to switch to the assigned game server and roomName |
|
CreateRoom ( string roomName, bool isVisible, bool isOpen, int maxPlayers, Hashtable customRoomProperties, string propsToListInLobby ) : void |
Creates a room with given name but fails if this room is existing already. If you don't want to create a unique room-name, pass null or "" as name and the server will assign a roomName (a GUID as string). Call this only on the master server. Internally, the master will respond with a server-address (and roomName, if needed). Both are used internally to switch to the assigned game server and roomName. PhotonNetwork.autoCleanUpPlayerObjects will become this room's AutoCleanUp property and that's used by all clients that join this room. |
|
Destroy ( GameObject go ) : void |
Destroys given GameObject. This GameObject must've been instantiated using PhotonNetwork.Instantiate and must have a PhotonView at it's root. This has the same effect as calling Destroy by passing an attached PhotonView from this GameObject
|
|
Destroy ( PhotonView view ) : void |
Destroy supplied PhotonView. This will remove all Buffered RPCs and destroy the GameObject this view is attached to (plus all childs, if any) This has the same effect as calling Destroy by passing a GameObject
|
|
DestroyPlayerObjects ( PhotonPlayer destroyPlayer ) : void |
Destroy all GameObjects/PhotonViews of this player. can only be called on the local player. The only exception is the master client which call call this for all players.
|
|
Disconnect ( ) : void |
Makes this client disconnect from the photon server, a process that leaves any room and calls OnDisconnectedFromPhoton on completition. When the client is connected, the server is being informed that this client disconnects. This speeds up leave/disconnect messages for players in the same room as you (otherwise the server would timeout this client's connection). When used in offlineMode, the state-change and event-call OnDisconnectedFromPhoton are immediate. Offline mode is set to false as well. Once disconnected, the client can connect again. Use ConnectUsingSettings. |
|
GetPing ( ) : int |
The current roundtrip time to the photon server
|
|
GetRoomList ( ) : RoomInfo[] |
Gets an array of (currently) known rooms as RoomInfo. This list is automatically updated every few seconds while this client is in the lobby (on the Master Server). Not available while being in a room. Creates a new instance of the list each time called. Copied from networkingPeer.mGameList. |
|
Instantiate ( string prefabName, Vector3 position, Quaternion rotation, int group ) : GameObject |
Instantiate a prefab over the network. This prefab needs to be located in the root of a "Resources" folder. Instead of using prefabs in the Resources folder, you can manually Instantiate and assign PhotonViews. See doc. |
|
Instantiate ( string prefabName, Vector3 position, Quaternion rotation, int group, object data ) : GameObject |
Instantiate a prefab over the network. This prefab needs to be located in the root of a "Resources" folder. Instead of using prefabs in the Resources folder, you can manually Instantiate and assign PhotonViews. See doc. |
|
InstantiateSceneObject ( string prefabName, Vector3 position, Quaternion rotation, int group, object data ) : GameObject |
Instantiate a scene-owned prefab over the network. The PhotonViews will be controllable by the MasterClient. This prefab needs to be located in the root of a "Resources" folder. Only the master client can Instantiate scene objects. Instead of using prefabs in the Resources folder, you can manually Instantiate and assign PhotonViews. See doc. |
|
InternalCleanPhotonMonoFromSceneIfStuck ( ) : void |
Internally used by Editor scripts, called on Hierarchy change (includes scene save) to remove surplus hidden PhotonHandlers.
|
|
JoinRandomRoom ( ) : void |
Joins any available room but will fail if none is currently available. If this fails, you can still create a room (and make this available for the next who uses JoinRandomRoom). Alternatively, try again in a moment. |
|
JoinRandomRoom ( Hashtable expectedCustomRoomProperties, byte expectedMaxPlayers ) : void |
Attempts to join an open room with fitting, custom properties but fails if none is currently available. If this fails, you can still create a room (and make this available for the next who uses JoinRandomRoom). Alternatively, try again in a moment. |
|
JoinRandomRoom ( Hashtable expectedCustomRoomProperties, byte expectedMaxPlayers, MatchmakingMode matchingType ) : void |
Attempts to join an open room with fitting, custom properties but fails if none is currently available. If this fails, you can still create a room (and make this available for the next who uses JoinRandomRoom). Alternatively, try again in a moment. |
|
JoinRoom ( RoomInfo listedRoom ) : void |
Join room by room.Name. This fails if the room is either full or no longer available (might close at the same time).
|
|
JoinRoom ( string roomName ) : void |
Join room with given title. This fails if the room is either full or no longer available (might close at the same time).
|
|
LeaveRoom ( ) : void |
Leave the current room
|
|
LoadLevel ( int levelNumber ) : void |
Loads the level and automatically pauses the network queue. Call this in OnJoinedRoom to make sure no cached RPCs are fired in the wrong scene.
|
|
LoadLevel ( string levelTitle ) : void |
Loads the level and automatically pauses the network queue. Call this in OnJoinedRoom to make sure no cached RPCs are fired in the wrong scene.
|
|
NetworkStatisticsReset ( ) : void |
Resets the traffic stats and re-enables them.
|
|
NetworkStatisticsToString ( ) : string |
Only available when NetworkStatisticsEnabled was used to gather some stats.
|
|
RemoveAllBufferedMessages ( ) : void |
Remove ALL buffered messages of the local player (RPC's and Instantiation calls) Note that this only removed the buffered messages on the server, you will still need to remove the Instantiated GameObjects yourself.
|
|
RemoveAllBufferedMessages ( PhotonPlayer targetPlayer ) : void |
Remove ALL buffered messages of a player (RPC's and Instantiation calls) Note that this only removed the buffered messages on the server, you will still need to remove the Instantiated GameObjects yourself.
|
|
RemoveAllInstantiatedObjects ( ) : void |
MasterClient method only: Destroy ALL instantiated GameObjects
|
|
RemoveAllInstantiatedObjects ( PhotonPlayer targetPlayer ) : void |
Destroy ALL PhotonNetwork.Instantiated GameObjects by given player. Can only be called on the local player or MasterClient. The MasterClient can call this for all players.
|
|
RemoveRPCs ( ) : void |
Remove ALL buffered RPCs of the local player
|
|
RemoveRPCs ( PhotonPlayer targetPlayer ) : void |
Remove ALL buffered RPCs of a player
|
|
RemoveRPCs ( PhotonView view ) : void |
Remove all buffered RPCs on given PhotonView (if they are owned by this player).
|
|
RemoveRPCsInGroup ( int group ) : void |
Remove all buffered RPCs with given group
|
|
SendOutgoingCommands ( ) : void |
Can be used to immediately send the RPCs and Instantiates just made, so they are on their way to the other players. This could be useful if you do a RPC to load a level and then load it yourself. While loading, no RPCs are sent to others, so this would delay the "load" RPC. You can send the RPC to "others", use this method, disable the message queue (by isMessageQueueRunning) and then load. |
|
SetLevelPrefix ( short prefix ) : void |
Sets level prefix for PhotonViews instantiated later on. Don't set it if you need only one! Important: If you don't use multiple level prefixes, simply don't set this value. The default value is optimized out of the traffic. This won't affect existing PhotonViews (they can't be changed yet for existing PhotonViews). Messages sent with a different level prefix will be received but not executed. This affects RPCs, Instantiates and synchronization. Be aware that PUN never resets this value, you'll have to do so yourself. |
|
SetPlayerCustomProperties ( Hashtable customProperties ) : void |
Sets this (local) player's properties. This caches the properties in PhotonNetwork.player.customProperties. CreateRoom, JoinRoom and JoinRandomRoom will all apply your player's custom properties when you enter the room. While in a room, your properties are synced with the other players. If the Hashtable is null, the custom properties will be cleared. Custom properties are never cleared automatically, so they carry over to the next room, if you don't change them. Don't set properties by modifying PhotonNetwork.player.customProperties! |
|
SetReceivingEnabled ( int group, bool enabled ) : void |
Enable/disable receiving on given group (applied to PhotonViews)
|
|
SetSendingEnabled ( int group, bool enabled ) : void |
Enable/disable sending on given group (applied to PhotonViews)
|
|
UnAllocateViewID ( int viewID ) : void |
Unregister a viewID (of manually instantiated and destroyed networked objects).
|
Method | Description | |
---|---|---|
AllocateSceneViewIDs ( int countOfNewViews ) : int[] | ||
AllocateViewID ( int ownerId ) : int | ||
Connect ( string serverAddress, int port, string uniqueGameID ) : void | ||
ConnectUsingSettings ( ) : void | ||
InitializeSecurity ( ) : void | ||
PhotonNetwork ( ) : System |
Static constructor used for basic setup.
|
|
RPC ( PhotonView view, string methodName, PhotonPlayer targetPlayer ) : void |
Internal to send an RPC on given PhotonView. Do not call this directly but use: PhotonView.RPC!
|
|
RPC ( PhotonView view, string methodName, PhotonTargets target ) : void |
Internal to send an RPC on given PhotonView. Do not call this directly but use: PhotonView.RPC!
|
|
VerifyCanUseNetwork ( ) : bool |
Helper function which is called inside this class to erify if certain functions can be used (e.g. RPC when not connected)
|
public static CloseConnection ( PhotonPlayer, kickPlayer ) : void | ||
kickPlayer | PhotonPlayer, | The PhotonPlayer to kick. |
return | void |
public static Connect ( string serverAddress, int port, string appID, string gameVersion ) : void | ||
serverAddress | string | The master server's address (either your own or Photon Cloud address). |
port | int | The master server's port to connect to. |
appID | string | Your application ID (Photon Cloud provides you with a GUID for your game). |
gameVersion | string | This client's version number. Users are separated from each other by gameversion (which allows you to make breaking changes). |
return | void |
public static ConnectUsingSettings ( string gameVersion ) : void | ||
gameVersion | string | This client's version number. Users are separated from each other by gameversion (which allows you to make breaking changes). |
return | void |
public static CreateRoom ( string roomName ) : void | ||
roomName | string | Unique name of the room to create. |
return | void |
public static CreateRoom ( string roomName, bool isVisible, bool isOpen, int maxPlayers ) : void | ||
roomName | string | Unique name of the room to create. Pass null or "" to make the server generate a name. |
isVisible | bool | Shows (or hides) this room from the lobby's listing of rooms. |
isOpen | bool | Allows (or disallows) others to join this room. |
maxPlayers | int | Max number of players that can join the room. |
return | void |
public static CreateRoom ( string roomName, bool isVisible, bool isOpen, int maxPlayers, Hashtable customRoomProperties, string propsToListInLobby ) : void | ||
roomName | string | Unique name of the room to create. Pass null or "" to make the server generate a name. |
isVisible | bool | Shows (or hides) this room from the lobby's listing of rooms. |
isOpen | bool | Allows (or disallows) others to join this room. |
maxPlayers | int | Max number of players that can join the room. |
customRoomProperties | Hashtable | Custom properties of the new room (set on create, so they are immediately available). |
propsToListInLobby | string | Array of custom-property-names that should be forwarded to the lobby (include only the useful ones). |
return | void |
public static Destroy ( GameObject go ) : void | ||
go | GameObject | |
return | void |
public static Destroy ( PhotonView view ) : void | ||
view | PhotonView | |
return | void |
public static DestroyPlayerObjects ( PhotonPlayer destroyPlayer ) : void | ||
destroyPlayer | PhotonPlayer | |
return | void |
public static Instantiate ( string prefabName, Vector3 position, Quaternion rotation, int group ) : GameObject | ||
prefabName | string | Name of the prefab to instantiate. |
position | Vector3 | Position Vector3 to apply on instantiation. |
rotation | Quaternion | Rotation Quaternion to apply on instantiation. |
group | int | The group for this PhotonView. |
return | GameObject |
public static Instantiate ( string prefabName, Vector3 position, Quaternion rotation, int group, object data ) : GameObject | ||
prefabName | string | Name of the prefab to instantiate. |
position | Vector3 | Position Vector3 to apply on instantiation. |
rotation | Quaternion | Rotation Quaternion to apply on instantiation. |
group | int | The group for this PhotonView. |
data | object | Optional instantiation data. This will be saved to it's PhotonView.instantiationData. |
return | GameObject |
public static InstantiateSceneObject ( string prefabName, Vector3 position, Quaternion rotation, int group, object data ) : GameObject | ||
prefabName | string | Name of the prefab to instantiate. |
position | Vector3 | Position Vector3 to apply on instantiation. |
rotation | Quaternion | Rotation Quaternion to apply on instantiation. |
group | int | The group for this PhotonView. |
data | object | Optional instantiation data. This will be saved to it's PhotonView.instantiationData. |
return | GameObject |
public static InternalCleanPhotonMonoFromSceneIfStuck ( ) : void | ||
return | void |
public static JoinRandomRoom ( Hashtable expectedCustomRoomProperties, byte expectedMaxPlayers ) : void | ||
expectedCustomRoomProperties | Hashtable | Filters for rooms that match these custom properties (string keys and values). To ignore, pass null. |
expectedMaxPlayers | byte | Filters for a particular maxplayer setting. Use 0 to accept any maxPlayer value. |
return | void |
public static JoinRandomRoom ( Hashtable expectedCustomRoomProperties, byte expectedMaxPlayers, MatchmakingMode matchingType ) : void | ||
expectedCustomRoomProperties | Hashtable | Filters for rooms that match these custom properties (string keys and values). To ignore, pass null. |
expectedMaxPlayers | byte | Filters for a particular maxplayer setting. Use 0 to accept any maxPlayer value. |
matchingType | MatchmakingMode | Selects one of the available matchmaking algorithms. See MatchmakingMode enum for options. |
return | void |
public static JoinRoom ( RoomInfo listedRoom ) : void | ||
listedRoom | RoomInfo | |
return | void |
public static JoinRoom ( string roomName ) : void | ||
roomName | string | Unique name of the room to create. |
return | void |
public static LoadLevel ( int levelNumber ) : void | ||
levelNumber | int | /// Number of the level to load (make sure it's in the build preferences). /// |
return | void |
public static LoadLevel ( string levelTitle ) : void | ||
levelTitle | string | /// Name of the level to load. /// |
return | void |
public static NetworkStatisticsReset ( ) : void | ||
return | void |
public static NetworkStatisticsToString ( ) : string | ||
return | string |
public static RemoveAllBufferedMessages ( ) : void | ||
return | void |
public static RemoveAllBufferedMessages ( PhotonPlayer targetPlayer ) : void | ||
targetPlayer | PhotonPlayer | |
return | void |
public static RemoveAllInstantiatedObjects ( ) : void | ||
return | void |
public static RemoveAllInstantiatedObjects ( PhotonPlayer targetPlayer ) : void | ||
targetPlayer | PhotonPlayer | |
return | void |
public static RemoveRPCs ( PhotonPlayer targetPlayer ) : void | ||
targetPlayer | PhotonPlayer | |
return | void |
public static RemoveRPCs ( PhotonView view ) : void | ||
view | PhotonView | |
return | void |
public static RemoveRPCsInGroup ( int group ) : void | ||
group | int | |
return | void |
public static SendOutgoingCommands ( ) : void | ||
return | void |
public static SetLevelPrefix ( short prefix ) : void | ||
prefix | short | Max value is short.MaxValue = 32767 |
return | void |
public static SetPlayerCustomProperties ( Hashtable customProperties ) : void | ||
customProperties | Hashtable | Only string-typed keys will be used from this hashtable. If null, custom properties are all deleted. |
return | void |
public static SetReceivingEnabled ( int group, bool enabled ) : void | ||
group | int | |
enabled | bool | |
return | void |
public static SetSendingEnabled ( int group, bool enabled ) : void | ||
group | int | |
enabled | bool | |
return | void |
public static UnAllocateViewID ( int viewID ) : void | ||
viewID | int | A viewID manually allocated by this player. |
return | void |
public static Dictionary |
||
return | GameObject>.Dictionary |
public static float precisionForFloatSynchronization | ||
return | float |
public static float precisionForQuaternionSynchronization | ||
return | float |