Photon Unity Networking 2: PhotonAnimatorView Class Reference

Photon Unity Networking 2

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 MonoBehaviour, 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...
 

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

void CacheDiscreteTriggers ( )

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

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
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
SynchronizeType GetLayerSynchronizeType ( int  layerIndex)

Gets the type how the layer is synchronized

Parameters
layerIndexIndex of the layer.
Returns
Disabled/Discrete/Continuous
SynchronizeType GetParameterSynchronizeType ( string  name)

Gets the type how the parameter is synchronized

Parameters
nameThe name of the parameter.
Returns
Disabled/Discrete/Continuous
List<SynchronizedLayer> GetSynchronizedLayers ( )

Get a list of all synchronized layers

Returns
List of SynchronizedLayer objects
List<SynchronizedParameter> GetSynchronizedParameters ( )

Get a list of all synchronized parameters

Returns
List of SynchronizedParameter objects
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.

void SetLayerSynchronized ( int  layerIndex,
SynchronizeType  synchronizeType 
)

Sets the how a layer should be synchronized

Parameters
layerIndexIndex of the layer.
synchronizeTypeDisabled/Discrete/Continuous
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
Online Documentation  -  Dashboard  -  Support Forum Exit Games GmbH