Exception GetDouble when number has no decimals (Unity C#)
Posted: 27 Nov 2016, 11:14
Hi,
InvalidCastException: Cannot cast from source type to destination type. is been thrown when try to get a double when it have no decimals.
This is an example sequence:
1-> A sends an ExtensionRequest. action.PutDouble(0.0,"x");
2-> Extension (server side) gets the action and sends it to B. trace( action.getDouble("x")) -> 0.0
3 -> B receives the action but when tries to get "x" value from it, the exception is thrown. If I Debug the action this is what I get:
3.1 -> Debug.Log (action.GetData("x").Data) -> 0
3.2 -> Debug.Log (action.GetData("x").Data.GetType()) -> System.Int32
If x value is 0.3 [ action.PutDouble(0.3,"x")] , it works fine.
This issue happens on server version 2.12.0 and C# client API version 1.7.0.
Thanks
InvalidCastException: Cannot cast from source type to destination type. is been thrown when try to get a double when it have no decimals.
This is an example sequence:
1-> A sends an ExtensionRequest. action.PutDouble(0.0,"x");
2-> Extension (server side) gets the action and sends it to B. trace( action.getDouble("x")) -> 0.0
3 -> B receives the action but when tries to get "x" value from it, the exception is thrown. If I Debug the action this is what I get:
3.1 -> Debug.Log (action.GetData("x").Data) -> 0
3.2 -> Debug.Log (action.GetData("x").Data.GetType()) -> System.Int32
If x value is 0.3 [ action.PutDouble(0.3,"x")] , it works fine.
This issue happens on server version 2.12.0 and C# client API version 1.7.0.
Thanks