I am trying to get a list of messages so that I can show the user at a later stage whether he has WON or LOST a challenge instead of showing it immediately when the listener gets called.
IList<GSData> messageList = response.MessageList gives a compile error on UNITY
"Cannot implicitly convert type `GameSparks.Core.GSEnumerable<GameSparks.Core.GSData>' to `System.Collections.Generic.IList<GameSparks.Core.GSData>'. An explicit conversion exists (are you missing a cast?)"
Any idea when these updates will reflect in the documentation? Or is there any other source that I can refer to?
Customer Support
said
over 6 years ago
Answer
Hi Deftouch Design
That forum post is outdated.
The new way to loop the messageList is as follows
foreach (var c in response.BaseData.GetGSDataList("messageList"))
{
}
Regards
Katie
D
Deftouch Design
said
over 6 years ago
It works on the test harness.
In fact when I print response.JsonString to console in Unity it shows me the entire message correctly.
The problem is only when I try to access the response.MessageList data via foreach loop.
Customer Support
said
over 6 years ago
Hi Deftouch Design
Have you tried calling ListMessageRequest in the Test Harness from the same player.
Does the Test Harness give you a list of messages?
Deftouch Design
I am trying to get a list of messages so that I can show the user at a later stage whether he has WON or LOST a challenge instead of showing it immediately when the listener gets called.
I have tried the following methods :
1. Code given under API reference:
IList<GSData> messageList = response.MessageList gives a compile error on UNITY
"Cannot implicitly convert type `GameSparks.Core.GSEnumerable<GameSparks.Core.GSData>' to `System.Collections.Generic.IList<GameSparks.Core.GSData>'. An explicit conversion exists (are you missing a cast?)"
2. Followed the answer given here :
Compile error goes away but the following foreach loop does not get executed. Hence, the output is never obtained by me.
If there is a better way to store the WIN/LOST message to show at a later instance, even that will do I suppose.
Thanks in advance!
Hi Deftouch Design
That forum post is outdated.
The new way to loop the messageList is as follows
foreach (var c in response.BaseData.GetGSDataList("messageList"))
{
}
Regards
Katie
- Oldest First
- Popular
- Newest First
Sorted by Newest FirstDeftouch Design
It is working now. Thanks you :)
Any idea when these updates will reflect in the documentation? Or is there any other source that I can refer to?
Customer Support
Hi Deftouch Design
That forum post is outdated.
The new way to loop the messageList is as follows
foreach (var c in response.BaseData.GetGSDataList("messageList"))
{
}
Regards
Katie
Deftouch Design
Customer Support
Hi Deftouch Design
Have you tried calling ListMessageRequest in the Test Harness from the same player.
Does the Test Harness give you a list of messages?
Regards
Katie
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics