C# Class PhotonView

Inheritance: Photon.MonoBehaviour
Show file Open project: daniel-cheng/stellar Class Usage Examples

Public Properties

Property Type Description
ObservedComponents List
group int
instantiationId int
observed Component
onSerializeRigidBodyOption OnSerializeRigidBody
onSerializeTransformOption OnSerializeTransform
ownerId int
ownershipTransfer OwnershipOption
prefixBackup int
synchronization ViewSynchronization

Protected Properties

Property Type Description
didAwake bool
lastOnSerializeDataReceived object[]
lastOnSerializeDataSent object[]
mixedModeIsReliable bool
removedFromLocalViewList bool

Public Methods

Method Description
DeserializeView ( PhotonStream, stream, PhotonMessageInfo, info ) : void
Find ( int viewID ) : PhotonView,
Get ( Component component ) : PhotonView,
Get ( GameObject gameObj ) : PhotonView,
RPC ( string methodName, PhotonPlayer, targetPlayer ) : void

Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client).

[Remote Procedure Calls](@ref rpcManual) 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](@ref rpcManual).

RPC ( string methodName, PhotonTargets target ) : void

Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client).

[Remote Procedure Calls](@ref rpcManual) 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](@ref rpcManual).

RefreshRpcMonoBehaviourCache ( ) : void

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() 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.

RequestOwnership ( ) : void

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.

RpcSecure ( string methodName, PhotonPlayer, targetPlayer, bool encrypt ) : void

Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client).

[Remote Procedure Calls](@ref rpcManual) 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](@ref rpcManual).

RpcSecure ( string methodName, PhotonTargets target, bool encrypt ) : void

Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client).

[Remote Procedure Calls](@ref rpcManual) 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](@ref rpcManual).

SerializeView ( PhotonStream, stream, PhotonMessageInfo, info ) : void
ToString ( ) : string
TransferOwnership ( PhotonPlayer, newOwner ) : void

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.

TransferOwnership ( int newOwnerId ) : void

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.

Protected Methods

Method Description
Awake ( ) : void

Called by Unity on start of the application and does a setup the PhotonView.

DeserializeComponent ( Component component, PhotonStream, stream, PhotonMessageInfo, info ) : void
ExecuteComponentOnSerialize ( Component component, PhotonStream, stream, PhotonMessageInfo, info ) : void
OnDestroy ( ) : void
SerializeComponent ( Component component, PhotonStream, stream, PhotonMessageInfo, info ) : void

Private Methods

Method Description
OpenPunWizard ( ) : void

Method Details

Awake() protected method

Called by Unity on start of the application and does a setup the PhotonView.
protected Awake ( ) : void
return void

DeserializeComponent() protected method

protected DeserializeComponent ( Component component, PhotonStream, stream, PhotonMessageInfo, info ) : void
component Component
stream PhotonStream,
info PhotonMessageInfo,
return void

DeserializeView() public method

public DeserializeView ( PhotonStream, stream, PhotonMessageInfo, info ) : void
stream PhotonStream,
info PhotonMessageInfo,
return void

ExecuteComponentOnSerialize() protected method

protected ExecuteComponentOnSerialize ( Component component, PhotonStream, stream, PhotonMessageInfo, info ) : void
component Component
stream PhotonStream,
info PhotonMessageInfo,
return void

Find() public static method

public static Find ( int viewID ) : PhotonView,
viewID int
return PhotonView,

Get() public static method

public static Get ( Component component ) : PhotonView,
component Component
return PhotonView,

Get() public static method

public static Get ( GameObject gameObj ) : PhotonView,
gameObj GameObject
return PhotonView,

OnDestroy() protected method

protected OnDestroy ( ) : void
return void

RPC() public method

Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client).
[Remote Procedure Calls](@ref rpcManual) 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](@ref rpcManual).
public RPC ( string methodName, PhotonPlayer, targetPlayer ) : void
methodName string The name of a fitting method that was has the RPC attribute.
targetPlayer PhotonPlayer, The group of targets and the way the RPC gets sent.
return void

RPC() public method

Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client).
[Remote Procedure Calls](@ref rpcManual) 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](@ref rpcManual).
public RPC ( string methodName, PhotonTargets target ) : void
methodName string The name of a fitting method that was has the RPC attribute.
target PhotonTargets The group of targets and the way the RPC gets sent.
return void

RefreshRpcMonoBehaviourCache() public method

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() 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.
public RefreshRpcMonoBehaviourCache ( ) : void
return void

RequestOwnership() public method

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.
public RequestOwnership ( ) : void
return void

RpcSecure() public method

Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client).
[Remote Procedure Calls](@ref rpcManual) 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](@ref rpcManual).
public RpcSecure ( string methodName, PhotonPlayer, targetPlayer, bool encrypt ) : void
methodName string The name of a fitting method that was has the RPC attribute.
targetPlayer PhotonPlayer, The group of targets and the way the RPC gets sent.
encrypt bool
return void

RpcSecure() public method

Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client).
[Remote Procedure Calls](@ref rpcManual) 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](@ref rpcManual).
public RpcSecure ( string methodName, PhotonTargets target, bool encrypt ) : void
methodName string The name of a fitting method that was has the RPC attribute.
target PhotonTargets The group of targets and the way the RPC gets sent.
encrypt bool
return void

SerializeComponent() protected method

protected SerializeComponent ( Component component, PhotonStream, stream, PhotonMessageInfo, info ) : void
component Component
stream PhotonStream,
info PhotonMessageInfo,
return void

SerializeView() public method

public SerializeView ( PhotonStream, stream, PhotonMessageInfo, info ) : void
stream PhotonStream,
info PhotonMessageInfo,
return void

ToString() public method

public ToString ( ) : string
return string

TransferOwnership() public method

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.
public TransferOwnership ( PhotonPlayer, newOwner ) : void
newOwner PhotonPlayer,
return void

TransferOwnership() public method

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.
public TransferOwnership ( int newOwnerId ) : void
newOwnerId int
return void

Property Details

ObservedComponents public property

public List ObservedComponents
return List

didAwake protected property

protected bool didAwake
return bool

group public property

public int group
return int

instantiationId public property

public int instantiationId
return int

lastOnSerializeDataReceived protected property

For internal use only, don't use
protected object[] lastOnSerializeDataReceived
return object[]

lastOnSerializeDataSent protected property

For internal use only, don't use
protected object[] lastOnSerializeDataSent
return object[]

mixedModeIsReliable protected property

protected bool mixedModeIsReliable
return bool

observed public property

public Component observed
return Component

onSerializeRigidBodyOption public property

public OnSerializeRigidBody onSerializeRigidBodyOption
return OnSerializeRigidBody

onSerializeTransformOption public property

public OnSerializeTransform onSerializeTransformOption
return OnSerializeTransform

ownerId public property

public int ownerId
return int

ownershipTransfer public property

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.
public OwnershipOption ownershipTransfer
return OwnershipOption

prefixBackup public property

public int prefixBackup
return int

removedFromLocalViewList protected property

protected bool removedFromLocalViewList
return bool

synchronization public property

public ViewSynchronization synchronization
return ViewSynchronization