InvalidCastException 'Int32' to type 'Double'.

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

ersindemir
Posts: 30
Joined: 30 Apr 2016, 07:23
Location: Turkey

InvalidCastException 'Int32' to type 'Double'.

Postby ersindemir » 07 Jun 2016, 19:54

Smartfox Server v : 2.9.0
Unity V: 5.3.5
Smartfox Client : 1.6.4.0

InvalidCastException: Unable to cast object of type 'Int32' to type 'Double'.
Sfs2X.Entities.Data.SFSObject.GetValue[Double] (System.String key)
Sfs2X.Entities.Data.SFSObject.GetDouble (System.String key)

user.GetVariable("variableName").GetDoubleValue() is running without exception on Android , IOS , Windows 10 PC , Windows Phone 8.1&10 , Unity Editor , but on WebGL exception occur.
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: InvalidCastException 'Int32' to type 'Double'.

Postby Bax » 09 Jun 2016, 16:27

We are investigating and should be able to report to you tomorrow.
We just need to know which WebGL publishing settings you are using... is it a development build or not? did you enable exceptions?
Paolo Bax
The SmartFoxServer Team
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: InvalidCastException 'Int32' to type 'Double'.

Postby Bax » 09 Jun 2016, 16:55

Can you show how you set the variable?
From our initial tests, if you pass the value as a double (for example 27.0), then everything works fine.
If you pass it as an integer (27), then the invalid cast exception occurs, but in the Editor too, not only in the final WebGL build.
Paolo Bax
The SmartFoxServer Team
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: InvalidCastException 'Int32' to type 'Double'.

Postby Bax » 09 Jun 2016, 17:37

Good news! I was able to reproduce the issue with SFS2X v2.9.0, but in later releases everything works fine.
Please download and install the latest patch available here: http://smartfoxserver.com/download/sfs2x#p=updates
Paolo Bax
The SmartFoxServer Team

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 21 guests