Cannot implicitly convert type `int' to `byte'. An explicit conversion exists (are you missing a cast?)
PhotonNetwork.CreateRoom(hostName, new RoomOptions() {
maxPlayers = maxPlayers[players], <------------Line of the error
isVisible = true,
isOpen = true,
customRoomProperties = roomOption,
cleanupCacheOnLeave = true,
customRoomPropertiesForLobby = properties
}, null);
}
,
Comment
Best Answer
Answer by Landern · Dec 15, 2016 at 09:49 PM
maxPlayers is of byte type in the class RoomOptions. You can use the Convert class to turn it into a type.
maxPlayers = System.Convert.ToByte(maxPlayers[players]),
Answer by Havax · Dec 15, 2016 at 09:07 PM
There is not enough code here to give an 'accurate' response. We'd need to know the variable types. Somewhere in that line, your attempting to convert something you've set as type int, into something you've set as type byte.