Sign In Register

How can we help you today?

Start a new topic
Answered

Unity SDK Register Callback on Gamesparks Events

Good Afternoon All,


I've been trying to register some custom functions to gamesparks events but having no luck.


The plan is when an opponent accepts a challenge and a ChallengeStarted Message is sent I'd like to inform everyone who is part of that challenge. My plan was to register a custom function to the ChallengeStarted message but after looking for examples (and trying random things) I've been unable to get it working.


I found this post which talks about registering for a callback but have had no luck so far, link http://www.gamesparks.com/blog/unity-and-gamesparks/.


In the example I don't understand where GameSparksApi is coming from.


Can anyone help?

Thanks,

Adam




Best Answer
Hi Adam
You can find out more about ChallengeStarted Message and GameSparks Request API here
To add a listener use

 

ChallengeTurnTakenMessage.Listener = (message) => {
    var challenge = message.Challenge; 
    String messageId = message.MessageId; 
    bool? notification = message.Notification; 
    GSEnumerable<GSData> scriptData = message.ScriptData; 
    String subTitle = message.SubTitle; 
    String summary = message.Summary; 
    String title = message.Title; 
    String who = message.Who; 
};

 

Thanks

Katie

 

 
1 Comment

Answer
Hi Adam
You can find out more about ChallengeStarted Message and GameSparks Request API here
To add a listener use

 

ChallengeTurnTakenMessage.Listener = (message) => {
    var challenge = message.Challenge; 
    String messageId = message.MessageId; 
    bool? notification = message.Notification; 
    GSEnumerable<GSData> scriptData = message.ScriptData; 
    String subTitle = message.SubTitle; 
    String summary = message.Summary; 
    String title = message.Title; 
    String who = message.Who; 
};

 

Thanks

Katie

 

 
Login to post a comment