Hi,
I am using cloud functions using C# with Unity. Having followed the cloud functions tutorial, I am using the following line to get the context of the call at the start of my cloud function:
FunctionExecutionContext<dynamic> context = JsonConvert.DeserializeObject<FunctionExecutionContext<dynamic>>(await req.ReadAsStringAsync());
This way is very convenient because I can pass a C# object as a parameter and get it back in the cloud function.
However I am trying to set objects on my player data and the only example I found requires a FunctionContext to work (see MakeEntityApiCall):
/* Use the ApiSettings and AuthenticationContext provided to the function as context for making API calls. */ var dataApi = new PlayFabDataInstanceAPI(context.ApiSettings, context.AuthenticationContext); /* Execute the entity API request */ var setObjectsResponse = await dataApi.SetObjectsAsync(setObjectRequest);
So my question is:
what is the best way to set objects on the player data overall?
Should I get the FunctionExecutionContext to read the argument as a class instance, but also get the FunctionContext to be able to use the PlayFabDataInstanceAPI?
P.S.: on a side note, when I try to use
var context = await FunctionContext<dynamic>.Create(req);
I get an error saying FunctionContext does not exist and VS Code doesn't suggest to add any using. How is that possible?