Unity Photon C# basics

Started by
4 comments, last by Adehm 6 years, 5 months ago

 

I was wondering if anyone knew how to simply send and receive an integer?

if (PhotonNetwork.isMasterClient) {

//send an integer

}

If(!PhotonNetwork.isMasterClient){

//receive integer

}

 

Advertisement

https://doc-api.photonengine.com/en/pun/current/class_photon_stream.html

SendNext() and ReceiveNext() to read/write data to the stream

Yeah I can’t get it to work. Was hoping someone would be able to get me a simple example of either making a stream or just adding to a stream before its sent and receiving it. Tried several different ways and can’t get anything to work even in the rare cases that I can write what I’m told without error it just wont do anything.

I haven't used Photon in a couple years but did you take a look at the demo (vikings IIRC) that comes with the package? IIRC that contained everything I needed to get it off the ground.

Thanks a bunch cmac you lead me to the solution. This video explains it wonderfully for anyone else who would like to know how to add data to the stream.

Kinda weird how you have to drag the script from a component to make it observable; didn't find a way to just do it manually through the control as it only allows me to select a gameobject and by default it's transform.

 

This topic is closed to new replies.

Advertisement