Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

How to typecast from a PhotonStream to a variable type

$
0
0
While this works, I would like to correctly typecast different variable types from a PhotonStream read (in Unity JavaScript) : function OnPhotonSerializeView( stream : PhotonStream, info : PhotonMessageInfo ) { if ( stream.isWriting ) { // We own this player: send the others our data stream.SendNext( transform.position ); stream.SendNext( transform.rotation ); stream.SendNext( desiredVelocity ); stream.SendNext( inputVector ); stream.SendNext( moveSpeed ); } else { // Network player, receive data transform.position = stream.ReceiveNext(); // ( Vector3 )stream.ReceiveNext(); transform.rotation = stream.ReceiveNext(); // ( Quaternion )stream.ReceiveNext(); desiredVelocity = stream.ReceiveNext(); // Vector3 inputVector = stream.ReceiveNext(); // Vector3 moveSpeed = stream.ReceiveNext(); // float } }

Viewing all articles
Browse latest Browse all 171066

Trending Articles



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