Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Strange casting exception...Please help

$
0
0
I have a static class that handles all of my network room data. The class normally works great but I am now getting a strange casting exception... Here is an example of a typical property getter and setter for this class public static bool remoteSeat1IsActive { get { Room room = PhotonNetwork.room; object[] seat1 = (object[])room.customProperties["seat1"]; return (bool)seat1[1]; } set { setRemoteSeat1IsActive(value); } } private static void setRemoteSeat1IsActive(bool value) { Room room = PhotonNetwork.room; //get seats hashtables Hashtable PlayerSeat1 = new Hashtable(); object[] seat1 = (object[])room.customProperties["seat1"]; object[] seat = { (bool)seat1[0], value, (string)seat1[2], (long)seat1[3], (int)seat1[4], (int)seat1[5], (int)seat1[6], (int)seat1[7] }; PlayerSeat1.Add("seat1", seat); room.SetCustomProperties(PlayerSeat1); } When from another class I call something like ... storage.remoteSeat1IsActive = true; it normally works... but now I am getting the following exception... InvalidCastException: Cannot cast from source type to destination type. Assets.BlackJack.Scripts.Game.Logic.storage.setRemoteSeat1IsSeated (Boolean value.... However I have checked both the source and destination types and they are both the same... If anyone knows why this might happen, it would be much appreciated... Best Regards, @NickThelen1

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>