Photon Unity Networking 2 2.45

Classes | Public Types | Public Member Functions | List of all members
PhotonAnimatorView Class Reference

This class helps you to synchronize Mecanim animations Simply add the component to your GameObject and make sure that the PhotonAnimatorView is added to the list of observed components More...

Inherits MonoBehaviourPun, and IPunObservable.

Classes

class  SynchronizedLayer
 
class  SynchronizedParameter
 

Public Types

enum  ParameterType
 
enum  SynchronizeType
 

Public Member Functions

void CacheDiscreteTriggers ()
 Caches the discrete triggers values for keeping track of raised triggers, and will be reseted after the sync routine got performed More...
 
bool DoesLayerSynchronizeTypeExist (int layerIndex)
 Check if a specific layer is configured to be synchronize More...
 
bool DoesParameterSynchronizeTypeExist (string name)
 Check if the specified parameter is configured to be synchronized More...
 
List< SynchronizedLayerGetSynchronizedLayers ()
 Get a list of all synchronized layers More...
 
List< SynchronizedParameterGetSynchronizedParameters ()
 Get a list of all synchronized parameters More...
 
SynchronizeType GetLayerSynchronizeType (int layerIndex)
 Gets the type how the layer is synchronized More...
 
SynchronizeType GetParameterSynchronizeType (string name)
 Gets the type how the parameter is synchronized More...
 
void SetLayerSynchronized (int layerIndex, SynchronizeType synchronizeType)
 Sets the how a layer should be synchronized More...
 
void SetParameterSynchronized (string name, ParameterType type, SynchronizeType synchronizeType)
 Sets the how a parameter should be synchronized More...
 
void OnPhotonSerializeView (PhotonStream stream, PhotonMessageInfo info)
 Called by PUN several times per second, so that your script can write and read synchronization data for the PhotonView. More...
 

Additional Inherited Members

- Properties inherited from MonoBehaviourPun
PhotonView photonView [get]
 A cached reference to a PhotonView on this GameObject. More...
 

Detailed Description

This class helps you to synchronize Mecanim animations Simply add the component to your GameObject and make sure that the PhotonAnimatorView is added to the list of observed components

When Using Trigger Parameters, make sure the component that sets the trigger is higher in the stack of Components on the GameObject than 'PhotonAnimatorView' Triggers are raised true during one frame only.

Member Function Documentation

◆ CacheDiscreteTriggers()

void CacheDiscreteTriggers ( )

Caches the discrete triggers values for keeping track of raised triggers, and will be reseted after the sync routine got performed

◆ DoesLayerSynchronizeTypeExist()

bool DoesLayerSynchronizeTypeExist ( int  layerIndex)

Check if a specific layer is configured to be synchronize

Parameters
layerIndexIndex of the layer.
Returns
True if the layer is synchronized

◆ DoesParameterSynchronizeTypeExist()

bool DoesParameterSynchronizeTypeExist ( string  name)

Check if the specified parameter is configured to be synchronized

Parameters
nameThe name of the parameter.
Returns
True if the parameter is synchronized

◆ GetLayerSynchronizeType()

SynchronizeType GetLayerSynchronizeType ( int  layerIndex)

Gets the type how the layer is synchronized

Parameters
layerIndexIndex of the layer.
Returns
Disabled/Discrete/Continuous

◆ GetParameterSynchronizeType()

SynchronizeType GetParameterSynchronizeType ( string  name)

Gets the type how the parameter is synchronized

Parameters
nameThe name of the parameter.
Returns
Disabled/Discrete/Continuous

◆ GetSynchronizedLayers()

List<SynchronizedLayer> GetSynchronizedLayers ( )

Get a list of all synchronized layers

Returns
List of SynchronizedLayer objects

◆ GetSynchronizedParameters()

List<SynchronizedParameter> GetSynchronizedParameters ( )

Get a list of all synchronized parameters

Returns
List of SynchronizedParameter objects

◆ OnPhotonSerializeView()

void OnPhotonSerializeView ( PhotonStream  stream,
PhotonMessageInfo  info 
)

Called by PUN several times per second, so that your script can write and read synchronization data for the PhotonView.

This method will be called in scripts that are assigned as Observed component of a PhotonView.
PhotonNetwork.SerializationRate affects how often this method is called.
PhotonNetwork.SendRate affects how often packages are sent by this client.

Implementing this method, you can customize which data a PhotonView regularly synchronizes. Your code defines what is being sent (content) and how your data is used by receiving clients.

Unlike other callbacks, OnPhotonSerializeView only gets called when it is assigned to a PhotonView as PhotonView.observed script.

To make use of this method, the PhotonStream is essential. It will be in "writing" mode" on the client that controls a PhotonView (PhotonStream.IsWriting == true) and in "reading mode" on the remote clients that just receive that the controlling client sends.

If you skip writing any value into the stream, PUN will skip the update. Used carefully, this can conserve bandwidth and messages (which have a limit per room/second).

Note that OnPhotonSerializeView is not called on remote clients when the sender does not send any update. This can't be used as "x-times per second Update()".

Implements IPunObservable.

◆ SetLayerSynchronized()

void SetLayerSynchronized ( int  layerIndex,
SynchronizeType  synchronizeType 
)

Sets the how a layer should be synchronized

Parameters
layerIndexIndex of the layer.
synchronizeTypeDisabled/Discrete/Continuous

◆ SetParameterSynchronized()

void SetParameterSynchronized ( string  name,
ParameterType  type,
SynchronizeType  synchronizeType 
)

Sets the how a parameter should be synchronized

Parameters
nameThe name of the parameter.
typeThe type of the parameter.
synchronizeTypeDisabled/Discrete/Continuous