Page 1 of 1

Unity C# SFSArrayLite cast Exception

Posted: 26 Jan 2017, 13:32
by ersindemir
Backend code (Java)
Collection<Integer> data = new ArrayList();
sfsObj.putIntArray("data", data);

I got exception from Client side when I try this code;
sfsObject.GetValue<int[]>("data");

InvalidCastException: Unable to cast object of type 'SFSArrayLite' to type 'Int32[]'.
at Sfs2X.Entities.Data.SFSObject.GetValue[Object] (System.String key) [0x00000] in <filename unknown>:0



Unity version : 5.5.0f3
Smartfox Client version : 1.6.6
Smartfox Backend version : 2.9.2 ( Same error 2.12.0)
Plaform : WebGL (No problem on Android , IOS)

Re: Unity C# SFSArrayLite cast Exception

Posted: 27 Jan 2017, 09:19
by Bax
Actually the GetValue method is an internal method that you should not use.
Please use sfsObject.GetIntArray(). This should fix it.

PS: we will make that method private in future releases of the API, to avoid this situation.