question

Jacob Grodman avatar image
Jacob Grodman asked

Storing Shared Group Data in a variable

I'm trying to pull a value from a key in a shared group data. You can see below that 'gameString' (which is a public static string declared earlier) is set to a value. If I print gameString in the success function, it gives me the info I want, but if I print gameString in any other function, it returns null.

I'm new to Unity, PlayFab, and C#, so am I just not understanding the fundamentals of this string?

    private static void PullGroupData(string sharedGroupId)
    {
        GetSharedGroupDataRequest request = new GetSharedGroupDataRequest()
        {
            SharedGroupId = sharedGroupId
        };
        PlayFabClientAPI.GetSharedGroupData(request, GetSharedDataSuccess, SharedDataError);
    }

    private static void GetSharedDataSuccess(GetSharedGroupDataResult result)
    {
        List<string> keyList = new List<string>(result.Data.Keys);
        gameString = result.Data[keyList[0]].Value;
    }

    private static void SharedDataError(PlayFabError error)
    {
        print("Group Data Error: " + error);
    }
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Jacob Grodman avatar image
Jacob Grodman answered

I was not understanding the fundamentals. Please disregard this. I would delete this thread, but I don't know how...

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Citrus Yan avatar image Citrus Yan commented ·

No problem, we will close this question for you.

0 Likes 0 ·