Sign In Register

How can we help you today?

Start a new topic

Get Team Request response.Team is null? Unity C#

Hi, Im using the Gamesparks_Unity_5.3.3.165.unitypackagefor Unity. Im trying to get the team members in the team.


Using the test harness I'm able to get the list of members, but at client side Unity, I checked the response.Team is = null. Only the JSONData is present. I followed the documentation for this Get Team Request but still couldn't solve my problem.


Any ideas? 


Shiwen


Hi Shiwen,


Can you paste the requests you made and the response + any errors here please?


Thanks,


Oisin

Hi Oisin,


At the moment, I reverted back to using sdk version 5.3.1.157 which is working for me. Below is the C# code I used in Unity.




The working C# code used in SDK version 5.3.1.157 :


string playerID;

string playerExternalID;

string playerDisplayName;


new GetTeamRequest ().SetTeamType ("friendsList").Send ((response) => {
if (response.HasErrors) {
Debug.Log ("Get team request error!");

else {

GSEnumerable<GetTeamResponse._Player> members = response.Members;
foreach (GetTeamResponse._Player user in members) {

playerID =user.Id;

playerExternalID = user.ExternalIDs.GetString("FB");

playerDisplayName = user.DisplayName;

}


So when i upgraded the SDK version to 5.3.3.165 , The C# implementation for it changes as well, So I tried to follow it:


string playerID;

string playerExternalID;

string playerDisplayName;


new GetTeamRequest ().SetTeamType ("friendsList").Send ((response) => {
if (response.HasErrors) {
Debug.Log ("Get team request error!");

else {

GSEnumerable<GetTeamResponse.__Teammembers = response.Team;  //  <--------------- the result from this response.Team = null or empty?
foreach (GetTeamResponse._Team user in members) {

playerID =user.Owner.Id; //<---My result is null

playerExternalID = user.Owner.ExternalIDs.GetString("FB"); //<----My result is null

playerDisplayName = user.Owner.DisplayName; //<---My result is null

}


Since the implementation changes, there is no response.Members. So I tried response.Team and response.Teams all are null/empty. Except the JSONData which holds the data I need. So do I need to do something like read from the JSONData and process it one by one into something like of a Dictionary<string,object> ?


Here is how it would look in the Test Harness:


Regards,

Shiwen


1 person likes this

Thank you so much for this! I've been trying to search and figure out how to get the list of my teams from GetTeamRequest. 


I came over from this guide here for the Social Friends System where I was able to add friends as teams. 


https://support.gamesparks.net/support/discussions/topics/1000053058

Login to post a comment