Open Hailiebaby16 opened 1 year ago
response.GetValue().GetRawText()
become response.ToString()
, i didn't update the example folder, sorry !
Bro what if the response is an array of int. How can i get their values?
response.GetValue().GetRawText()
becomeresponse.ToString()
, i didn't update the example folder, sorry !
var obj = response.GetValue<YOUR_TYPE>();
replace YOUR_TYPE with the class name or the type you want to serialize to e.g YOUR_TYPE can be: string[], SomeClass, int and so on
already mentioned in the Readme: https://github.com/itisnajim/SocketIOUnity#receiving
var obj = response.GetValue<YOUR_TYPE>();
replace YOUR_TYPE with the class name or the type you want to serialize to e.g YOUR_TYPE can be: string[], SomeClass, int and so on
already mentioned in the Readme: https://github.com/itisnajim/SocketIOUnity#receiving
I've tried doing that but it gives me error. The only time i dont have error is when i use IList as my class but not able to access the value
check if the server send the correct data, maybe its a string rather that list of objects, this is not a list => "[\"item1\", \"item2\"]"
and i recommend to use a list wrapper instead of a direct list e.g a class named StringsList that has a property data of type string[]
without a debug log or a snippet of code i can't tell whats the cause of your problem.
I'm tryring your sample code and i got this error
Severity Code Description Project File Line Suppression State Error CS0012 The type 'JsonElement' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Text.Json, Version=6.0.0.4
andSeverity Code Description Project File Line Suppression State Error CS0411 The type arguments for method 'SocketIOResponse.GetValue<T>(int)' cannot be inferred from the usage. Try specifying the type arguments explicitly
from this line of code.ReceivedText.text += "Received On " + name + " : " + response.GetValue().GetRawText() + "\n";