Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all articles
Browse latest Browse all 8947

Difference between the Photon Transform View component and the OnPhotonSerializeView method?

$
0
0
Hello,

I am quite new to photon PUN so sorry if this question sounds redundant!

I wanted to know if there is any difference in the way data is sent between using the Photon Transform View component on a gameobject and implementing the OnPhotonSerializeView method in a script on that gameobject to send the position.

For instance if I was to use the Photon Transform View to send the position of the player would it be any different from doing this?:
#region IPunObservable implementation

        public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
        {
            if (stream.IsWriting)
            {
                // We own this player: send the others our data
                stream.SendNext(gameobject.transform.position);
                
            }
            else
            {
                // Network player, receive data
               gameobject.transform.position = (Vector3)stream.ReceiveNext();
            }
        }

#endregion

Any difference in terms of performance and bandiwth limitation over the photon cloud server? Is one aproach 'right' and the other 'wrong' for some reason?

Viewing all articles
Browse latest Browse all 8947

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>