And I'm able to see it in the Test harness but I have issue on how to use it in unity as I want. The following code Log " List message succes " but the list is empty .... Any ideas ? Am i missing something ?
: new ListMessageRequest().Send((response) => {
if (!response.HasErrors) { Debug.Log("List message success"); foreach (var data in MessageList) { Debug.Log("message"); }
Thanks for the response, but I still have an empty list. How can I iterate trought this GsData List ?
"Debug.Log(response.JSONString);" shows me my messages so I'm sure to have it, anyway the list is still empty.
Thanks in advance.
Customer Support
said
over 7 years ago
Hi Lorent
Are you using the latest gameSparks SDK ? If not please update, the sdk can be found here Using the newest SDK should give you a response. To iterate through the response and put them in an array
ArrayList messageList = new ArrayList();
new ListMessageRequest().Send((response) =>
{
foreach (var c in response.MessageList)
{
messageList.Add(c.GetString("messageId"));
}
});
Thanks Katie
D
Deftouch Design
said
over 6 years ago
Hi Lorent,
Did this work for you? It never enters the foreach loop in my case.
This statement gives a compile error :
IList<GSData> messageList = response.MessageList;
Regards
L
Lorent Marie
said
over 6 years ago
You are right Deftouch, sorry for the customer service but their answer doesn't work. Here is how I did :
this.messages = new List<GSMessage>(); new ListMessageRequest().SetDurable(true).Send((response) => { Debug.Log(response.JSONString); List<GSData> mlist = response.BaseData.GetGSDataList("messageList"); foreach (GSData data in mlist) { GSMessage o = new GSMessage(data); this.messages.Add(o); } }); }
Hope this help ! If so, up my answer because the wrong answer is mark as the best ( lulz )
Lorent Marie
Hello their !
After 8h I'm still in trouble with the List message request. I've send a test message that log in Unity thanks to the Platformbase code :
public void DebugMsg(String message){
ExecuteOnMainThread(() => {
if (message.Length < 1500)
{
Debug.Log("GS: " + message);
} else
{
Debug.Log("GS: " + message.Substring(0, 1500) + "...");
}
GameSparksController.Instance.CheckMessage();
});
}
And I'm able to see it in the Test harness but I have issue on how to use it in unity as I want.
The following code Log " List message succes " but the list is empty .... Any ideas ? Am i missing something ?
:
new ListMessageRequest().Send((response) =>
{
if (!response.HasErrors)
{
Debug.Log("List message success");
foreach (var data in MessageList)
{
Debug.Log("message");
}
}
else
{
Debug.Log("List message error");
}
});
Thanks in advance !
Hi Lorent
To get the message list from the response use
IList<GSData> messageList = response.MessageList;
The c# listmessagerequest API can be found here
Thanks
Katie
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstCustomer Support
Hi Lorent
To get the message list from the response use
IList<GSData> messageList = response.MessageList;
The c# listmessagerequest API can be found here
Thanks
Katie
Lorent Marie
"Debug.Log(response.JSONString);" shows me my messages so I'm sure to have it, anyway the list is still empty.
Thanks in advance.
Customer Support
Are you using the latest gameSparks SDK ? If not please update, the sdk can be found here
Using the newest SDK should give you a response.
To iterate through the response and put them in an array
Thanks
Katie
Deftouch Design
Hi Lorent,
Did this work for you? It never enters the foreach loop in my case.
This statement gives a compile error :
IList<GSData> messageList = response.MessageList;
Regards
Lorent Marie
Here is how I did :
this.messages = new List<GSMessage>();
new ListMessageRequest().SetDurable(true).Send((response) =>
{
Debug.Log(response.JSONString);
List<GSData> mlist = response.BaseData.GetGSDataList("messageList");
foreach (GSData data in mlist)
{
GSMessage o = new GSMessage(data);
this.messages.Add(o);
}
});
}
Hope this help ! If so, up my answer because the wrong answer is mark as the best ( lulz )
Good day !
Deftouch Design
hey Lorent, looks like the API has changed.
I posted a similar question here https://support.gamesparks.net/support/discussions/topics/1000078809 where they gave me the correct solution.
Anyway thanks for the response.
Lorent Marie
Yep, that's the same way I did...Funny I found it before customer service haha :D
-
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