Error: NotSupportedException: Strings that exceed a UTF8-encoded
Options
I am experiencing an error in photon. I use custom proprieties if a room with a hashtable.
Here is the code:
And the error is this:
How to repair it?
Here is the code:
public void createRoom(){ if (roomNameTX.text == "") { roomNameTX.gameObject.transform.parent.GetComponent<InputField>().text = roomNameGen(); } roomName = roomNameTX.text; foreach (RoomInfo info in PhotonNetwork.GetRoomList()) { if (info.name == roomName) { error("Room name already in use."); return; } } if(!PlayerPrefs.HasKey("playerName")) PhotonNetwork.playerName = "player"; else PhotonNetwork.playerName = PlayerPrefs.GetString("playerName"); RoomOptions ro = new RoomOptions(); ro.maxPlayers = 8; ro.customRoomProperties = new Hashtable(); ro.customRoomProperties.Add("MapName", map); ro.customRoomProperties.Add("RoundDuration", time * 60); if (gamemode == "Deathmatch") { ro.customRoomProperties.Add("GameMode", "DM"); } else { ro.customRoomProperties.Add("GameMode", "TDM"); } ro.customRoomProperties.Add("Password", password); ro.customRoomProperties.Add("Weapons", weapons); PhotonNetwork.CreateRoom(roomName, ro, TypedLobby.Default); loadingPan.active = true; }
And the error is this:
NotSupportedException: Strings that exceed a UTF8-encoded byte-length of 32767 (short.MaxValue) are not supported. Yours is: 42714
ExitGames.Client.Photon.Protocol.SerializeString (System.IO.MemoryStream dout, System.String serObject, Boolean setType)
ExitGames.Client.Photon.Protocol.Serialize (System.IO.MemoryStream dout, System.Object serObject, Boolean setType)
ExitGames.Client.Photon.Protocol.SerializeHashTable (System.IO.MemoryStream dout, ExitGames.Client.Photon.Hashtable serObject, Boolean setType)
ExitGames.Client.Photon.Protocol.Serialize (System.IO.MemoryStream dout, System.Object serObject, Boolean setType)
ExitGames.Client.Photon.Protocol.SerializeString (System.IO.MemoryStream dout, System.String serObject, Boolean setType)
ExitGames.Client.Photon.Protocol.Serialize (System.IO.MemoryStream dout, System.Object serObject, Boolean setType)
ExitGames.Client.Photon.Protocol.SerializeHashTable (System.IO.MemoryStream dout, ExitGames.Client.Photon.Hashtable serObject, Boolean setType)
ExitGames.Client.Photon.Protocol.Serialize (System.IO.MemoryStream dout, System.Object serObject, Boolean setType)
How to repair it?
0
Comments
-
Hi @edimemune,
As the error clearly states and as shown in the "Serialization in Photon" docs page, Photon supports strings with up to 32767 characters.
I'm wondering how you managed to reach that limit and exceed it...exception message states that the string length is 42714! wow! can you log those strings before using them in Photon.0