This container is used in OnPhotonSerializeView() to either provide incoming data of a PhotonView or for you to provide it. More...
Public Member Functions | |
PhotonStream (bool write, object[] incomingData) | |
Creates a stream and initializes it. Used by PUN internally. More... | |
void | SetReadStream (object[] incomingData, int pos=0) |
object | ReceiveNext () |
Read next piece of data from the stream when IsReading is true. More... | |
object | PeekNext () |
Read next piece of data from the stream without advancing the "current" item. More... | |
void | SendNext (object obj) |
Add another piece of data to send it when IsWriting is true. More... | |
bool | CopyToListAndClear (List< object > target) |
object [] | ToArray () |
Turns the stream into a new object[]. More... | |
void | Serialize (ref bool myBool) |
Will read or write the value, depending on the stream's IsWriting value. More... | |
void | Serialize (ref int myInt) |
Will read or write the value, depending on the stream's IsWriting value. More... | |
void | Serialize (ref string value) |
Will read or write the value, depending on the stream's IsWriting value. More... | |
void | Serialize (ref char value) |
Will read or write the value, depending on the stream's IsWriting value. More... | |
void | Serialize (ref short value) |
Will read or write the value, depending on the stream's IsWriting value. More... | |
void | Serialize (ref float obj) |
Will read or write the value, depending on the stream's IsWriting value. More... | |
void | Serialize (ref Player obj) |
Will read or write the value, depending on the stream's IsWriting value. More... | |
void | Serialize (ref Vector3 obj) |
Will read or write the value, depending on the stream's IsWriting value. More... | |
void | Serialize (ref Vector2 obj) |
Will read or write the value, depending on the stream's IsWriting value. More... | |
void | Serialize (ref Quaternion obj) |
Will read or write the value, depending on the stream's IsWriting value. More... | |
Properties | |
bool | IsWriting [get] |
If true, this client should add data to the stream to send it. More... | |
bool | IsReading [get] |
If true, this client should read data send by another client. More... | |
int | Count [get] |
Count of items in the stream. More... | |
Detailed Description
This container is used in OnPhotonSerializeView() to either provide incoming data of a PhotonView or for you to provide it.
The IsWriting property will be true if this client is the "owner" of the PhotonView (and thus the GameObject). Add data to the stream and it's sent via the server to the other players in a room. On the receiving side, IsWriting is false and the data should be read.
Send as few data as possible to keep connection quality up. An empty PhotonStream will not be sent.
Use either Serialize() for reading and writing or SendNext() and ReceiveNext(). The latter two are just explicit read and write methods but do about the same work as Serialize(). It's a matter of preference which methods you use.
Constructor & Destructor Documentation
◆ PhotonStream()
Photon.Pun.PhotonStream.PhotonStream | ( | bool | write, |
object [] | incomingData | ||
) |
Creates a stream and initializes it. Used by PUN internally.
Member Function Documentation
◆ CopyToListAndClear()
bool Photon.Pun.PhotonStream.CopyToListAndClear | ( | List< object > | target | ) |
◆ PeekNext()
object Photon.Pun.PhotonStream.PeekNext | ( | ) |
Read next piece of data from the stream without advancing the "current" item.
◆ ReceiveNext()
object Photon.Pun.PhotonStream.ReceiveNext | ( | ) |
Read next piece of data from the stream when IsReading is true.
◆ SendNext()
void Photon.Pun.PhotonStream.SendNext | ( | object | obj | ) |
Add another piece of data to send it when IsWriting is true.
◆ Serialize() [1/10]
void Photon.Pun.PhotonStream.Serialize | ( | ref bool | myBool | ) |
Will read or write the value, depending on the stream's IsWriting value.
◆ Serialize() [2/10]
void Photon.Pun.PhotonStream.Serialize | ( | ref int | myInt | ) |
Will read or write the value, depending on the stream's IsWriting value.
◆ Serialize() [3/10]
void Photon.Pun.PhotonStream.Serialize | ( | ref string | value | ) |
Will read or write the value, depending on the stream's IsWriting value.
◆ Serialize() [4/10]
void Photon.Pun.PhotonStream.Serialize | ( | ref char | value | ) |
Will read or write the value, depending on the stream's IsWriting value.
◆ Serialize() [5/10]
void Photon.Pun.PhotonStream.Serialize | ( | ref short | value | ) |
Will read or write the value, depending on the stream's IsWriting value.
◆ Serialize() [6/10]
void Photon.Pun.PhotonStream.Serialize | ( | ref float | obj | ) |
Will read or write the value, depending on the stream's IsWriting value.
◆ Serialize() [7/10]
void Photon.Pun.PhotonStream.Serialize | ( | ref Player | obj | ) |
Will read or write the value, depending on the stream's IsWriting value.
◆ Serialize() [8/10]
void Photon.Pun.PhotonStream.Serialize | ( | ref Vector3 | obj | ) |
Will read or write the value, depending on the stream's IsWriting value.
◆ Serialize() [9/10]
void Photon.Pun.PhotonStream.Serialize | ( | ref Vector2 | obj | ) |
Will read or write the value, depending on the stream's IsWriting value.
◆ Serialize() [10/10]
void Photon.Pun.PhotonStream.Serialize | ( | ref Quaternion | obj | ) |
Will read or write the value, depending on the stream's IsWriting value.
◆ SetReadStream()
void Photon.Pun.PhotonStream.SetReadStream | ( | object [] | incomingData, |
int | pos = 0 |
||
) |
◆ ToArray()
object [] Photon.Pun.PhotonStream.ToArray | ( | ) |
Turns the stream into a new object[].
Property Documentation
◆ Count
|
get |
Count of items in the stream.
◆ IsReading
|
get |
If true, this client should read data send by another client.
◆ IsWriting
|
get |
If true, this client should add data to the stream to send it.
The documentation for this class was generated from the following file:
- 3rd-Party/Photon/PhotonUnityNetworking/Code/PunClasses.cs