[英]Unity Photon Send data to server
How to possible send data to server and save them there in Unity 5 and Photon? 如何将数据发送到服务器并将其保存在Unity 5和Photon中? for example send device UID, device Model, Device Name.
例如,发送设备UID,设备型号,设备名称。
You can override OnPhotonSerializeView to write & read data. 您可以重写OnPhotonSerializeView来写入和读取数据。
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info){
if (stream.isWriting) {
// Write device info
stream.SendNext (deviceUID);
stream.SendNext (deviceModel);
stream.SendNext (deviceName);
} else {
// Read device info
deviceUID = (string)stream.ReceiveNext ();
deviceModel = (string)stream.ReceiveNext ();
deviceName = (string)stream.ReceiveNext ();
}
}
The order of the variables you send should be in the same order you receive them. 您发送的变量的顺序应与接收它们的顺序相同。 Your object also has to have a PhotonView attached to it.
您的对象还必须具有一个PhotonView。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.