unityのphotonのOnPhotonSerializeView()のデータ送信について
データ送信を以下の通り絶えず送り続けているのですが、
photonの同期はこのように常に送り続けるものなのでしょうか?
自分としては数値が変わったときのみ送信されるのかと思ってるのですが。
これが本来の動きなのかどうかのかを知っている方いましたら教えて欲しいです。
公式では
https://doc.photonengine.com/ja-jp/pun/current/getting-started/feature-overview
更新分だけ送ると書いてある気がします。
ObserveOptionはUnreliable on Changeになっています。
以下のようにデータを送ってます。
#PhotonManager.cs
GameObject member = PhotonNetwork.Instantiate ("Member", new Vector3 (0.0f, 0.0f, 0.0f), Quaternion.Euler(Vector3.zero),0); member.name = "Member"+member.GetComponent<PhotonView>().ownerId;
#MemberScript.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; public class MemberScript : Photon.MonoBehaviour { public string str = "hoge"; // Use this for initialization void Start () { } // Update is called once per frame void Update () { } void Awake() { this.name = "Member"+GetComponent<PhotonView> ().ownerId; } void OnPhotonSerializeView( PhotonStream stream, PhotonMessageInfo info ) { if (stream.isWriting) { Debug.Log ("member isWriting="+str); //データの送信 stream.SendNext(str); } else { Debug.Log ("member isread="+str); //データの受信 this.str = (string)stream.ReceiveNext(); } } }
![guest](/img/icon/icnUserSample.jpg)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/10/17 19:01
2017/10/20 07:10