PUN 1.17 and SetLevelPrefix

Updating to PUN 1.17 and got this error :
InvalidCastException: Cannot cast from source type to destination type.
NetworkingPeer.ExecuteRPC (System.Collections.Hashtable rpcData, .PhotonPlayer sender) (at Assets/Plugins/PhotonNetwork/NetworkingPeer.cs:1445)
NetworkingPeer.OnEvent (ExitGames.Client.Photon.EventData photonEvent) (at Assets/Plugins/PhotonNetwork/NetworkingPeer.cs:1330)
ExitGames.Client.Photon.PeerBase.DeserializeMessageAndCallback (System.Byte[] inBuff)
ExitGames.Client.Photon.EnetPeer.DispatchIncomingCommands ()
ExitGames.Client.Photon.PhotonPeer.DispatchIncomingCommands ()
PhotonHandler.Update () (at Assets/Plugins/PhotonNetwork/PhotonHandler.cs:65)

In changelog.txt :
Changed: PhotonNetwork.SetLevelPrefix() is now short typed. It practically never happens that you have more than 32k levels (and short saves a bit of traffic)

But in NetworkingPeer.cs (line 1445) :
if (rpcData.ContainsKey((byte)1))
{
otherSidePrefix = (int)rpcData[(byte)1];
}

Change... it to...
if (rpcData.ContainsKey((byte)1))
{
otherSidePrefix = (short)rpcData[(byte)1];
}

... and have a nice day.

Comments