Sign In Register

How can we help you today?

Start a new topic
Answered

calling gs event from unity is not working

 I want to trigger an event that i made in gs portal from c# unity script but its giving me this error :The best overloaded method match for `GameSparks.Api.Requests.LogEventRequest.LogEventRequest(GameSparks.Core.GSInstance)' has some invalid arguments


Here is my code snippet: 

GSRequestData parameters = new GSRequestData().AddString("CC_ATTR","saad").AddNumber("CC_ATTR_2",1).AddJSONStringAsObject("CC_ATTR_3","name:saad");
new LogEventRequest("CC_EVT").SetScriptData(parameters).Send ((response) => {
Debug.Log(response.JSONString);
Debug.Log("ABOVE ME");

});

In other questions people are using GamesparksSend to trigger events but its obselete now im not sure its not recognizing it even though i have all the imports.


Best Answer

 

GSRequestData parameters = new GSRequestData().AddString("CC_ATTR","saad").AddNumber("CC_ATTR_2",1).AddJSONStringAsObject("CC_ATTR_3","name:saad");
new LogEventRequest().SetEventKey("CC_EVT").SetScriptData(parameters).Send ((response) => {
Debug.Log(response.JSONString);
Debug.Log("ABOVE ME");

});

 You cannot set the event key in the constructor of LogEventRequest. Use SetEventKey().

1 Comment

Answer

 

GSRequestData parameters = new GSRequestData().AddString("CC_ATTR","saad").AddNumber("CC_ATTR_2",1).AddJSONStringAsObject("CC_ATTR_3","name:saad");
new LogEventRequest().SetEventKey("CC_EVT").SetScriptData(parameters).Send ((response) => {
Debug.Log(response.JSONString);
Debug.Log("ABOVE ME");

});

 You cannot set the event key in the constructor of LogEventRequest. Use SetEventKey().

Login to post a comment