I've got some code that will run after x time then checks if the player is online and if they are I want to send some data to the player in the most efficient manner possible but I can't find a way without messily using cloud code to call a request to call a response and back to Unity.
Is there by any chance any code that I can force a message to be sent to the client and catch it with a callback in Unity?
Thank you
Best Answer
T
Tech Support
said
over 5 years ago
You could use script messages, this how you send them from Cloud Code:
var message = Spark.message();
message.setMessageData({"example":21,"example2":"foo"});
message.setPlayerIds(["id1","id2",Spark.getPlayer().getPlayerId()])
message.send()
In unity you'd have a script message listener to intercept these messages. The data will be saved using setMessageData. To set up a listener and retrieve data from it please visit the following doc page:
You could use script messages, this how you send them from Cloud Code:
var message = Spark.message();
message.setMessageData({"example":21,"example2":"foo"});
message.setPlayerIds(["id1","id2",Spark.getPlayer().getPlayerId()])
message.send()
In unity you'd have a script message listener to intercept these messages. The data will be saved using setMessageData. To set up a listener and retrieve data from it please visit the following doc page:
Ian Kettlewell
I've got some code that will run after x time then checks if the player is online and if they are I want to send some data to the player in the most efficient manner possible but I can't find a way without messily using cloud code to call a request to call a response and back to Unity.
Is there by any chance any code that I can force a message to be sent to the client and catch it with a callback in Unity?
Thank you
You could use script messages, this how you send them from Cloud Code:
In unity you'd have a script message listener to intercept these messages. The data will be saved using setMessageData. To set up a listener and retrieve data from it please visit the following doc page:
https://docs.gamesparks.com/api-documentation/message-api/misc/scriptmessage.html
Hope this helps,
Omar
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstTech Support
You could use script messages, this how you send them from Cloud Code:
In unity you'd have a script message listener to intercept these messages. The data will be saved using setMessageData. To set up a listener and retrieve data from it please visit the following doc page:
https://docs.gamesparks.com/api-documentation/message-api/misc/scriptmessage.html
Hope this helps,
Omar
Ian Kettlewell
-
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