Photon Unity Networking 2
2.12
|
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 | ( | int | sampleRate | ) |
Initializes a new instance of the PhotonStreamQueue class.
- Parameters
-
sampleRate How many times per second should the object states be sampled
Member Function Documentation
void Deserialize | ( | PhotonStream | stream | ) |
Deserializes the specified stream. Call this in your OnPhotonSerializeView method to receive the whole recorded stream.
- Parameters
-
stream The PhotonStream you receive as a parameter in OnPhotonSerializeView
bool HasQueuedObjects | ( | ) |
Determines whether the queue has stored any objects
object ReceiveNext | ( | ) |
Receives the next object from the queue. This works just like PhotonStream.ReceiveNext
- Returns
void Reset | ( | ) |
Resets the PhotonStreamQueue. You need to do this whenever the amount of objects you are observing changes
void SendNext | ( | object | obj | ) |
Adds the next object to the queue. This works just like PhotonStream.SendNext
- Parameters
-
obj The object you want to add to the queue
void Serialize | ( | PhotonStream | stream | ) |
Serializes the specified stream. Call this in your OnPhotonSerializeView method to send the whole recorded stream.
- Parameters
-
stream The PhotonStream you receive as a parameter in OnPhotonSerializeView