PhotonNetwork: RPC sending enum

Hey,

I was wondering why it is impossible to send enumeration when we’re online but no problem happens when we’re offline ?

/summon @tobiass

Thanks.

up

Do this:

public enum Weapons : byte
{
     Rifle = 0,
     Shotgun,
     Pistol,
     Grenade
}

//And send it as a byte
photonView.RPC("Blablabla", PhotonTarget.All, (byte)Weapons.Shotgun);

//Convert it in the function
private void Blablabla(byte weaponType)
{
   Weapons newWeapon = (Weapons)weaponType;
}
1 Like

Yeah I know how to solve this, but I was wondering why it (doesn’t) works depending of the connection state…

Because the error likely occurs once you hit serialization. However, if you’re offline then there is no reason Photon should internally go through the motions. That is my guess.

1 Like

Hmm. That makes sense !

1 Like

@Glader : Correct. Thanks.

1 Like