PUN's NetworkView replacement class for networking. Use it like a NetworkView. More...
Inherits Photon.MonoBehaviour.
Public Member Functions | |
void | RequestOwnership () |
Depending on the PhotonView's ownershipTransfer setting, any client can request to become owner of the PhotonView. More... | |
void | TransferOwnership (PhotonPlayer newOwner) |
Transfers the ownership of this PhotonView (and GameObject) to another player. More... | |
void | TransferOwnership (int newOwnerId) |
Transfers the ownership of this PhotonView (and GameObject) to another player. More... | |
void | OnMasterClientSwitched (PhotonPlayer newMasterClient) |
Check ownerId assignment for sceneObjects to keep being owned by the MasterClient. More... | |
void | SerializeView (PhotonStream stream, PhotonMessageInfo info) |
void | DeserializeView (PhotonStream stream, PhotonMessageInfo info) |
void | RefreshRpcMonoBehaviourCache () |
Can be used to refesh the list of MonoBehaviours on this GameObject while PhotonNetwork.UseRpcMonoBehaviourCache is true. More... | |
void | RPC (string methodName, PhotonTargets target, params object[] parameters) |
Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client). More... | |
void | RpcSecure (string methodName, PhotonTargets target, bool encrypt, params object[] parameters) |
Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client). More... | |
void | RPC (string methodName, PhotonPlayer targetPlayer, params object[] parameters) |
Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client). More... | |
void | RpcSecure (string methodName, PhotonPlayer targetPlayer, bool encrypt, params object[] parameters) |
Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client). More... | |
override string | ToString () |
Static Public Member Functions | |
static PhotonView | Get (Component component) |
static PhotonView | Get (GameObject gameObj) |
static PhotonView | Find (int viewID) |
Public Attributes | |
int | ownerId |
byte | group = 0 |
bool | OwnerShipWasTransfered |
Flag to check if ownership of this photonView was set during the lifecycle. Used for checking when joining late if event with mismatched owner and sender needs addressing. More... | |
int | prefixBackup = -1 |
ViewSynchronization | synchronization |
OnSerializeTransform | onSerializeTransformOption = OnSerializeTransform.PositionAndRotation |
OnSerializeRigidBody | onSerializeRigidBodyOption = OnSerializeRigidBody.All |
OwnershipOption | ownershipTransfer = OwnershipOption.Fixed |
Defines if ownership of this PhotonView is fixed, can be requested or simply taken. More... | |
List< Component > | ObservedComponents |
int | instantiationId |
int | currentMasterID = -1 |
The current master ID so that we can compare when we receive OnMasterClientSwitched() callback It's public so that we can check it during ownerId assignments in networkPeer script TODO: Maybe we can have the networkPeer always aware of the previous MasterClient? More... | |
Properties | |
int | prefix [get, set] |
object[] | instantiationData [get, set] |
This is the instantiationData that was passed when calling PhotonNetwork.Instantiate* (if that was used to spawn this prefab) More... | |
int | viewID [get, set] |
The ID of the PhotonView. Identifies it in a networked game (per room). More... | |
bool | isSceneView [get] |
True if the PhotonView was loaded with the scene (game object) or instantiated with InstantiateSceneObject. More... | |
PhotonPlayer | owner [get] |
The owner of a PhotonView is the player who created the GameObject with that view. Objects in the scene don't have an owner. More... | |
int | OwnerActorNr [get] |
bool | isOwnerActive [get] |
int | CreatorActorNr [get] |
bool | isMine [get] |
True if the PhotonView is "mine" and can be controlled by this client. More... | |
Properties inherited from Photon.MonoBehaviour | |
PhotonView | photonView [get] |
A cached reference to a PhotonView on this GameObject. More... | |
new PhotonView?? | networkView [get] |
This property is only here to notify developers when they use the outdated value. More... | |
PUN's NetworkView replacement class for networking. Use it like a NetworkView.
void PhotonView.DeserializeView | ( | PhotonStream | stream, |
PhotonMessageInfo | info | ||
) |
|
static |
|
static |
|
static |
void PhotonView.OnMasterClientSwitched | ( | PhotonPlayer | newMasterClient | ) |
Check ownerId assignment for sceneObjects to keep being owned by the MasterClient.
newMasterClient | New master client. |
void PhotonView.RefreshRpcMonoBehaviourCache | ( | ) |
Can be used to refesh the list of MonoBehaviours on this GameObject while PhotonNetwork.UseRpcMonoBehaviourCache is true.
Set PhotonNetwork.UseRpcMonoBehaviourCache to true to enable the caching. Uses this.GetComponents<MonoBehaviour>() to get a list of MonoBehaviours to call RPCs on (potentially).
While PhotonNetwork.UseRpcMonoBehaviourCache is false, this method has no effect, because the list is refreshed when a RPC gets called.
void PhotonView.RequestOwnership | ( | ) |
Depending on the PhotonView's ownershipTransfer setting, any client can request to become owner of the PhotonView.
Requesting ownership can give you control over a PhotonView, if the ownershipTransfer setting allows that. The current owner might have to implement IPunCallbacks.OnOwnershipRequest to react to the ownership request.
The owner/controller of a PhotonView is also the client which sends position updates of the GameObject.
void PhotonView.RPC | ( | string | methodName, |
PhotonPlayer | targetPlayer, | ||
params object[] | parameters | ||
) |
Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client).
Remote Procedure Calls are an essential tool in making multiplayer games with PUN. It enables you to make every client in a room call a specific method.
This method allows you to make an RPC calls on a specific player's client. Of course, calls are affected by this client's lag and that of remote clients.
Each call automatically is routed to the same PhotonView (and GameObject) that was used on the originating client.
See: Remote Procedure Calls.
methodName | The name of a fitting method that was has the RPC attribute. |
targetPlayer | The group of targets and the way the RPC gets sent. |
parameters | The parameters that the RPC method has (must fit this call!). |
void PhotonView.RPC | ( | string | methodName, |
PhotonTargets | target, | ||
params object[] | parameters | ||
) |
Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client).
Remote Procedure Calls are an essential tool in making multiplayer games with PUN. It enables you to make every client in a room call a specific method.
RPC calls can target "All" or the "Others". Usually, the target "All" gets executed locally immediately after sending the RPC. The "*ViaServer" options send the RPC to the server and execute it on this client when it's sent back. Of course, calls are affected by this client's lag and that of remote clients.
Each call automatically is routed to the same PhotonView (and GameObject) that was used on the originating client.
See: Remote Procedure Calls.
methodName | The name of a fitting method that was has the RPC attribute. |
target | The group of targets and the way the RPC gets sent. |
parameters | The parameters that the RPC method has (must fit this call!). |
void PhotonView.RpcSecure | ( | string | methodName, |
PhotonPlayer | targetPlayer, | ||
bool | encrypt, | ||
params object[] | parameters | ||
) |
Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client).
Remote Procedure Calls are an essential tool in making multiplayer games with PUN. It enables you to make every client in a room call a specific method.
This method allows you to make an RPC calls on a specific player's client. Of course, calls are affected by this client's lag and that of remote clients.
Each call automatically is routed to the same PhotonView (and GameObject) that was used on the originating client.
See: Remote Procedure Calls.
param name="methodName">The name of a fitting method that was has the RPC attribute.
param name="targetPlayer">The group of targets and the way the RPC gets sent.
param name="encrypt">
param name="parameters">The parameters that the RPC method has (must fit this call!).
void PhotonView.RpcSecure | ( | string | methodName, |
PhotonTargets | target, | ||
bool | encrypt, | ||
params object[] | parameters | ||
) |
Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client).
Remote Procedure Calls are an essential tool in making multiplayer games with PUN. It enables you to make every client in a room call a specific method.
RPC calls can target "All" or the "Others". Usually, the target "All" gets executed locally immediately after sending the RPC. The "*ViaServer" options send the RPC to the server and execute it on this client when it's sent back. Of course, calls are affected by this client's lag and that of remote clients.
Each call automatically is routed to the same PhotonView (and GameObject) that was used on the originating client.
See: Remote Procedure Calls.
param name="methodName">The name of a fitting method that was has the RPC attribute.
param name="target">The group of targets and the way the RPC gets sent.
param name="encrypt">
param name="parameters">The parameters that the RPC method has (must fit this call!).
void PhotonView.SerializeView | ( | PhotonStream | stream, |
PhotonMessageInfo | info | ||
) |
override string PhotonView.ToString | ( | ) |
void PhotonView.TransferOwnership | ( | int | newOwnerId | ) |
Transfers the ownership of this PhotonView (and GameObject) to another player.
The owner/controller of a PhotonView is also the client which sends position updates of the GameObject.
void PhotonView.TransferOwnership | ( | PhotonPlayer | newOwner | ) |
Transfers the ownership of this PhotonView (and GameObject) to another player.
The owner/controller of a PhotonView is also the client which sends position updates of the GameObject.
int PhotonView.currentMasterID = -1 |
The current master ID so that we can compare when we receive OnMasterClientSwitched() callback It's public so that we can check it during ownerId assignments in networkPeer script TODO: Maybe we can have the networkPeer always aware of the previous MasterClient?
byte PhotonView.group = 0 |
int PhotonView.instantiationId |
List<Component> PhotonView.ObservedComponents |
OnSerializeRigidBody PhotonView.onSerializeRigidBodyOption = OnSerializeRigidBody.All |
OnSerializeTransform PhotonView.onSerializeTransformOption = OnSerializeTransform.PositionAndRotation |
int PhotonView.ownerId |
OwnershipOption PhotonView.ownershipTransfer = OwnershipOption.Fixed |
Defines if ownership of this PhotonView is fixed, can be requested or simply taken.
Note that you can't edit this value at runtime. The options are described in enum OwnershipOption. The current owner has to implement IPunCallbacks.OnOwnershipRequest to react to the ownership request.
bool PhotonView.OwnerShipWasTransfered |
Flag to check if ownership of this photonView was set during the lifecycle. Used for checking when joining late if event with mismatched owner and sender needs addressing.
true
if owner ship was transfered; otherwise, false
.
int PhotonView.prefixBackup = -1 |
ViewSynchronization PhotonView.synchronization |
|
get |
|
getset |
This is the instantiationData that was passed when calling PhotonNetwork.Instantiate* (if that was used to spawn this prefab)
|
get |
True if the PhotonView is "mine" and can be controlled by this client.
PUN has an ownership concept that defines who can control and destroy each PhotonView. True in case the owner matches the local PhotonPlayer. True if this is a scene photonview on the Master client.
|
get |
|
get |
True if the PhotonView was loaded with the scene (game object) or instantiated with InstantiateSceneObject.
Scene objects are not owned by a particular player but belong to the scene. Thus they don't get destroyed when their creator leaves the game and the current Master Client can control them (whoever that is). The ownerId is 0 (player IDs are 1 and up).
|
get |
The owner of a PhotonView is the player who created the GameObject with that view. Objects in the scene don't have an owner.
The owner/controller of a PhotonView is also the client which sends position updates of the GameObject.
Ownership can be transferred to another player with PhotonView.TransferOwnership or any player can request ownership by calling the PhotonView's RequestOwnership method. The current owner has to implement IPunCallbacks.OnOwnershipRequest to react to the ownership request.
|
get |
|
getset |
|
getset |
The ID of the PhotonView. Identifies it in a networked game (per room).