Photon Unity Networking v1.101

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

Classes

class  SynchronizedLayer
 
class  SynchronizedParameter
 

Public Types

enum  ParameterType { ParameterType.Float = 1, ParameterType.Int = 3, ParameterType.Bool = 4, ParameterType.Trigger = 9 }
 
enum  SynchronizeType { SynchronizeType.Disabled = 0, SynchronizeType.Discrete = 1, SynchronizeType.Continuous = 2 }
 

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 Enumeration Documentation

◆ ParameterType

Enumerator
Float 
Int 
Bool 
Trigger 

◆ SynchronizeType

Enumerator
Disabled 
Discrete 
Continuous 

Member Function Documentation

◆ CacheDiscreteTriggers()

void PhotonAnimatorView.CacheDiscreteTriggers ( )

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

◆ DoesLayerSynchronizeTypeExist()

bool PhotonAnimatorView.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 PhotonAnimatorView.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 PhotonAnimatorView.GetLayerSynchronizeType ( int  layerIndex)

Gets the type how the layer is synchronized

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

◆ GetParameterSynchronizeType()

SynchronizeType PhotonAnimatorView.GetParameterSynchronizeType ( string  name)

Gets the type how the parameter is synchronized

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

◆ GetSynchronizedLayers()

List<SynchronizedLayer> PhotonAnimatorView.GetSynchronizedLayers ( )

Get a list of all synchronized layers

Returns
List of SynchronizedLayer objects

◆ GetSynchronizedParameters()

List<SynchronizedParameter> PhotonAnimatorView.GetSynchronizedParameters ( )

Get a list of all synchronized parameters

Returns
List of SynchronizedParameter objects

◆ OnPhotonSerializeView()

void PhotonAnimatorView.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.sendRateOnSerialize 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 PhotonAnimatorView.SetLayerSynchronized ( int  layerIndex,
SynchronizeType  synchronizeType 
)

Sets the how a layer should be synchronized

Parameters
layerIndexIndex of the layer.
synchronizeTypeDisabled/Discrete/Continuous

◆ SetParameterSynchronized()

void PhotonAnimatorView.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