Sign In Register

How can we help you today?

Start a new topic

CreateChallenge .. game crashes .. what am i doing wrong

here is the function .. the crash log is below it...

public
 void CreateChallenge()
 {
 string accessType = "PRIVATE";
 bool autoStartJoinedChallengeOnMaxPlayers = true;
 string challengeMessage = "ChallengeMessage";
 string challengeShortCode = "chalRanked";
 int currency1Wager = 1;
 int currency2Wager = 2;
 int currency3Wager = 3;
 int currency4Wager = 4;
 int currency5Wager = 5;
 int currency6Wager = 6;
 List <string> usersToChallenge = new List<string> ();
 usersToChallenge.Add ("571c5a371474e704b6f15379");
 DateTime dateVar = DateTime.MinValue;
 Debug.Log ("test " + usersToChallenge[0]);
 new CreateChallengeRequest()
 .SetAccessType(accessType)
 .SetAutoStartJoinedChallengeOnMaxPlayers(autoStartJoinedChallengeOnMaxPlayers)
 .SetChallengeMessage(challengeMessage)
 .SetChallengeShortCode(challengeShortCode)
 .SetCurrency1Wager(currency1Wager)
 .SetCurrency2Wager(currency2Wager)
 .SetCurrency3Wager(currency3Wager)
 .SetCurrency4Wager(currency4Wager)
 .SetCurrency5Wager(currency5Wager)
 .SetCurrency6Wager(currency6Wager)
 .SetEligibilityCriteria(null)
 .SetEndTime(dateVar)
 .SetExpiryTime(dateVar)
 .SetMaxAttempts(2)
 .SetMaxPlayers(2)
 .SetMinPlayers(2)
 .SetSilent(false)
 .SetStartTime(dateVar)
 .SetUsersToChallenge(usersToChallenge)
 .Send((response) => {
 string challengeInstanceId = response.ChallengeInstanceId; 
 GameSparks.Core.GSData scriptData = response.ScriptData; 
 Debug.Log(challengeInstanceId + " instanceID");
 });
 }




crash log.. 


NullReferenceException: Object reference not set to an instance of an object

GameSparks.Core.GSRequestData.AddObject (System.String paramName, GameSparks.Core.GSData child) (at c:/Program Files (x86)/Jenkins/jobs/clientsdk-dotnet-master/workspace/GameSparks.Api/Core/GSRequestData.cs:164)

GameSparks.Core.GSRequest.AddObject (System.String paramName, GameSparks.Core.GSData child) (at c:/Program Files (x86)/Jenkins/jobs/clientsdk-dotnet-master/workspace/GameSparks.Api/Core/GSRequest.cs:198)

GameSparks.Api.Requests.CreateChallengeRequest.SetEligibilityCriteria (GameSparks.Core.GSRequestData eligibilityCriteria) (at c:/Program Files (x86)/Jenkins/jobs/clientsdk-dotnet-master/workspace/GameSparks.Api/GSRequests.cs:887)

ChallengeManager.CreateChallenge () (at Assets/Scripts/ChallengeManager.cs:53)

FriendManager.<GetFriends>m__19 (GameSparks.Api.Responses.ListGameFriendsResponse response) (at Assets/Scripts/FriendManager.cs:46)

GameSparks.Core.GSTypedRequest`2+<>c__DisplayClass1[GameSparks.Api.Requests.ListGameFriendsRequest,GameSparks.Api.Responses.ListGameFriendsResponse].<Send>b__0 (GameSparks.Core.GSObject response) (at c:/Program Files (x86)/Jenkins/jobs/clientsdk-dotnet-master/workspace/GameSpark



...  so i call ChallengeManager.CreateChallenge () .. but then game crashes... thnx for ur help


so it happens i should not have used null for eligibilityCriteria .. this is what i used to make it run.. im not sure if it is right 

GameSparks.Core.GSRequestData reqData = new GameSparks.Core.GSRequestData ();

Hi Vic,


Will need to take a look at the scene to properly diagnose this issue.

Could you make a support ticket here and upload an otherwise empty scene that has this problem?


Thanks,


Oisin

so u can't reproduce the crash with the function call i posted above? just use the same parameters and u would be able to repro it... for now i used GameSparks.Core.GSRequestData reqData = new GameSparks.Core.GSRequestData ();  .. and used reqData in SetEligibilityCriteria(reqData) .. in the crash it was SetEligibilityCriteria(null)

Login to post a comment