Hello,
My problem is this: I am trying to make a Global Leaderboard, where I acquire all the users in my Playfab game and compare them via one of their Virtual Currencies via the "server.GetPlayersInSegment". I've got this working well and my code does indeed work perfectly the first time the player starts the game. The problem occurs on the second call when I attempt to execute my Cloud Script the same way. The CloudScript hits its OnSuccess delegate properly, but its FunctionResult is null. I'm not sure why this would occur and have been trying to figure it out for a while now.
This is not a time issue, as I can wait a minute and the same result occurs. There are not other calls going out at the same time, I am not overloading Playfab API in anyway that I know (and it works the first time perfectly, like I said).
My Title ID: 59E9
My SegmentId: "D53793B198C24BA0" (All Players SegmentID)
UE Engine: 4.15.0 VR Works
Playfab Script:
// Get the leaderboard serverside so we can get the player's tags too (their full displaynames) // handlers.getLeaderboardWithTags = function (args, context) { var resultLeaderboard = server.GetPlayersInSegment({ SegmentId: "D53793B198C24BA0", // All Players SegmentID // SecondsToLive: 300, MaxBatchSize: 10000 //ContinuationToken: false // *Set to "true" when we need to call again and reach over 10,000 Players // }); if(resultLeaderboard == null) log.debug("resultLeaderboard is null!"); return { messageValue: resultLeaderboard }; // Return the resultLeaderboard // };
My Blueprint structure:
My Log:
-------------- BEGIN LOG --------------
- Successful at the start of the game:
Length of array which contains all players in Playfab: 3900 *DIFFERENT WAY* Length of array which contains all players in Playfab: 0 *DIFFERENT WAY* Warning: 0 players found in Global Leaderboard Gathering process
- An error in the middle of the game where the function "getLeaderboardWithTags" returns a null FunctionResult:
Warning: RecievedAllLeaderboardPlayers returned Null FunctionResult in Global Leaderboard Gathering process LogJson:Warning: Field messageValue was not found. LogJson:Error: Json Value of type 'Null' used as a 'Object'. LogJson:Warning: Field PlayerProfiles was not found. LogJson:Error: Json Value of type 'Null' used as a 'Array'. *DIFFERENT WAY* Length of array which contains all players in Playfab: 0 *DIFFERENT WAY* Warning: 0 players found in Global Leaderboard Gathering process
-------------- END LOG --------------
The Json warnings/errors are related to the "Different Way" method.