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... | |
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.
PhotonStream | ( | bool | write, |
object[] | incomingData | ||
) |
Creates a stream and initializes it. Used by PUN internally.
object PeekNext | ( | ) |
Read next piece of data from the stream without advancing the "current" item.
object ReceiveNext | ( | ) |
Read next piece of data from the stream when IsReading is true.
void SendNext | ( | object | obj | ) |
Add another piece of data to send it when IsWriting is true.
void Serialize | ( | ref bool | myBool | ) |
Will read or write the value, depending on the stream's IsWriting value.
void Serialize | ( | ref char | value | ) |
Will read or write the value, depending on the stream's IsWriting value.
void Serialize | ( | ref float | obj | ) |
Will read or write the value, depending on the stream's IsWriting value.
void Serialize | ( | ref int | myInt | ) |
Will read or write the value, depending on the stream's IsWriting value.
void Serialize | ( | ref Player | obj | ) |
Will read or write the value, depending on the stream's IsWriting value.
void Serialize | ( | ref Quaternion | obj | ) |
Will read or write the value, depending on the stream's IsWriting value.
void Serialize | ( | ref short | value | ) |
Will read or write the value, depending on the stream's IsWriting value.
void Serialize | ( | ref string | value | ) |
Will read or write the value, depending on the stream's IsWriting value.
void Serialize | ( | ref Vector2 | obj | ) |
Will read or write the value, depending on the stream's IsWriting value.
void Serialize | ( | ref Vector3 | obj | ) |
Will read or write the value, depending on the stream's IsWriting value.
object [] ToArray | ( | ) |
Turns the stream into a new object[].
|
get |
Count of items in the stream.
|
get |
If true, this client should read data send by another client.
|
get |
If true, this client should add data to the stream to send it.