Photon Unity Networking 2 2.45

Public Member Functions | List of all members
PhotonStreamQueue Class Reference

The PhotonStreamQueue helps you poll object states at higher frequencies than what PhotonNetwork.SendRate dictates and then sends all those states at once when Serialize() is called. On the receiving end you can call Deserialize() and then the stream will roll out the received object states in the same order and timeStep they were recorded in. More...

Public Member Functions

 PhotonStreamQueue (int sampleRate)
 Initializes a new instance of the PhotonStreamQueue class. More...
 
void Reset ()
 Resets the PhotonStreamQueue. You need to do this whenever the amount of objects you are observing changes More...
 
void SendNext (object obj)
 Adds the next object to the queue. This works just like PhotonStream.SendNext More...
 
bool HasQueuedObjects ()
 Determines whether the queue has stored any objects More...
 
object ReceiveNext ()
 Receives the next object from the queue. This works just like PhotonStream.ReceiveNext More...
 
void Serialize (PhotonStream stream)
 Serializes the specified stream. Call this in your OnPhotonSerializeView method to send the whole recorded stream. More...
 
void Deserialize (PhotonStream stream)
 Deserializes the specified stream. Call this in your OnPhotonSerializeView method to receive the whole recorded stream. More...
 

Detailed Description

The PhotonStreamQueue helps you poll object states at higher frequencies than what PhotonNetwork.SendRate dictates and then sends all those states at once when Serialize() is called. On the receiving end you can call Deserialize() and then the stream will roll out the received object states in the same order and timeStep they were recorded in.

Constructor & Destructor Documentation

◆ PhotonStreamQueue()

PhotonStreamQueue ( int  sampleRate)

Initializes a new instance of the PhotonStreamQueue class.

Parameters
sampleRateHow many times per second should the object states be sampled

Member Function Documentation

◆ Deserialize()

void Deserialize ( PhotonStream  stream)

Deserializes the specified stream. Call this in your OnPhotonSerializeView method to receive the whole recorded stream.

Parameters
streamThe PhotonStream you receive as a parameter in OnPhotonSerializeView

◆ HasQueuedObjects()

bool HasQueuedObjects ( )

Determines whether the queue has stored any objects

◆ ReceiveNext()

object ReceiveNext ( )

Receives the next object from the queue. This works just like PhotonStream.ReceiveNext

Returns

◆ Reset()

void Reset ( )

Resets the PhotonStreamQueue. You need to do this whenever the amount of objects you are observing changes

◆ SendNext()

void SendNext ( object  obj)

Adds the next object to the queue. This works just like PhotonStream.SendNext

Parameters
objThe object you want to add to the queue

◆ Serialize()

void Serialize ( PhotonStream  stream)

Serializes the specified stream. Call this in your OnPhotonSerializeView method to send the whole recorded stream.

Parameters
streamThe PhotonStream you receive as a parameter in OnPhotonSerializeView