Sometime, at least on IOS, my unity client get unable to receive any messages from GameSparks. I'm still able to receive response to my requests, and the active player is marked as online in its player record (as seen on the NoSQL portal). Also the messages are not kept and sent afterward when I'm logging the player on the test harness (where the messages are always correctly received).
My game need players to quite often reliably receive messages from the server and I'm at a lost to find the solution to this problem. Any way to figure it out would be helpful.
I use Spark.sendMessageByIdWithoutPush()
I do not use the challenge functionalities.
Best Answer
G
Gabriel Sauve
said
over 7 years ago
I think I found my problem.
I had, quite some time ago, followed THIS to create my message listener:
All was well until i reloaded the scene and screwed the delegate. I was rarely reloading the scene (only to change the active language) so it was usually no problem and I had not noticed the problem as everything seemed nice at first glance. I admittedly have not much experience with delegates but the error messages seemed to come from everywhere apart from this.
Hi Gabriel. Do you already have a live version out? If yes, have you checked preview build in GameSparksSettings in Unity when you tested the method?
G
Gabriel Sauve
said
over 7 years ago
I don't have any live snapshot yet and PreviewBuild and DebugBuild is checked in GameSparksSettings. Also I don't think I ever missed a message when playing inside the unity editor. It is only happening on my testing iPad (I haven't tested my game on android yet).
Often, everything is working fine on my iOS device and then it suddenly stop interpreting messages.
D
Davendra Jayasingam
said
over 7 years ago
I've tested on the iPhone, and it works. Your Unity code is correct. Your cloud code may be the problem. It's noteworthy that Spark.getPlayerIds() always returns an empty array (at least for me). This however works.
Spark.sendMessageWithoutPush({"alert" : "The time in ms is "+Date.now()}, new Array(Spark.getPlayer()));
You can get by sending messages to all players by doing something like this
var nameListCollection = Spark.runtimeCollection("playerDirectory").find();
var nameList = new Array();
while(nameListCollection.hasNext())
{
var myPlayer = nameListCollection.next();
nameList.push(Spark.loadPlayer(myPlayer.playerId));
}
Spark.sendMessage({"alert" : "You've just won a car!"}, nameList);
D
Davendra Jayasingam
said
over 7 years ago
Revision: sendMessage can be replaced with sendMessageWithoutPush and it would work just the same.
G
Gabriel Sauve
said
over 7 years ago
Answer
I think I found my problem.
I had, quite some time ago, followed THIS to create my message listener:
All was well until i reloaded the scene and screwed the delegate. I was rarely reloading the scene (only to change the active language) so it was usually no problem and I had not noticed the problem as everything seemed nice at first glance. I admittedly have not much experience with delegates but the error messages seemed to come from everywhere apart from this.
Gabriel Sauve
Sometime, at least on IOS, my unity client get unable to receive any messages from GameSparks. I'm still able to receive response to my requests, and the active player is marked as online in its player record (as seen on the NoSQL portal). Also the messages are not kept and sent afterward when I'm logging the player on the test harness (where the messages are always correctly received).
My game need players to quite often reliably receive messages from the server and I'm at a lost to find the solution to this problem. Any way to figure it out would be helpful.
I use Spark.sendMessageByIdWithoutPush()
I do not use the challenge functionalities.
I think I found my problem.
I had, quite some time ago, followed THIS to create my message listener:
But I had forgot to had this to the provided code:
All was well until i reloaded the scene and screwed the delegate. I was rarely reloading the scene (only to change the active language) so it was usually no problem and I had not noticed the problem as everything seemed nice at first glance. I admittedly have not much experience with delegates but the error messages seemed to come from everywhere apart from this.
I hope this will help someone else.
- Oldest First
- Popular
- Newest First
Sorted by PopularDavendra Jayasingam
Gabriel Sauve
I don't have any live snapshot yet and PreviewBuild and DebugBuild is checked in GameSparksSettings. Also I don't think I ever missed a message when playing inside the unity editor. It is only happening on my testing iPad (I haven't tested my game on android yet).
I use this to read messages:
Often, everything is working fine on my iOS device and then it suddenly stop interpreting messages.
Davendra Jayasingam
I've tested on the iPhone, and it works. Your Unity code is correct. Your cloud code may be the problem. It's noteworthy that Spark.getPlayerIds() always returns an empty array (at least for me). This however works.
You can get by sending messages to all players by doing something like this
Davendra Jayasingam
Revision: sendMessage can be replaced with sendMessageWithoutPush and it would work just the same.
Gabriel Sauve
I think I found my problem.
I had, quite some time ago, followed THIS to create my message listener:
But I had forgot to had this to the provided code:
All was well until i reloaded the scene and screwed the delegate. I was rarely reloading the scene (only to change the active language) so it was usually no problem and I had not noticed the problem as everything seemed nice at first glance. I admittedly have not much experience with delegates but the error messages seemed to come from everywhere apart from this.
I hope this will help someone else.
-
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