question

Greg Quinn avatar image
Greg Quinn asked

Setting GeneratePlayStreamEvent = true when debugging Azure Functions locally doesn't generate the event in the PlayStream

I am calling the following code in Unity...

PlayFabCloudScriptAPI.ExecuteFunction(new ExecuteFunctionRequest()
{
    Entity = new PlayFab.CloudScriptModels.EntityKey()
    {
        Id = PlayFabSettings.staticPlayer.EntityId, //Get this from when you logged in,
        Type = PlayFabSettings.staticPlayer.EntityType, //Get this from when you logged in
    },
    FunctionName = "HelloWorld", //This should be the name of your Azure Function that you created.
    //FunctionParameter = new Dictionary<string, string>() { { "name", "Greg" } }, //This is the data that you would want to pass into your function.
    GeneratePlayStreamEvent = true //Set this to true if you would like this call to show up in PlayStream
}, (ExecuteFunctionResult result) =>
{
    if (result.FunctionResultTooLarge ?? false)
    {
        Debug.Log("This can happen if you exceed the limit that can be returned from an Azure Function, See PlayFab Limits Page for details.");
        return;
    }
    Debug.Log($"The {result.FunctionName} function took {result.ExecutionTimeMilliseconds} to complete");
    Debug.Log($"Result: {result.FunctionResult.ToString()}");
}, (PlayFabError error) =>
{
    Debug.Log($"Opps Something went wrong: {error.GenerateErrorReport()}");
});
If I debug the Azure function locally, and monitor the PlayStream, it doesn't generate the PlaySteam event in PlayFab PlayStream UI.

However, if I publish this function to Azure, then call it from my Unity client, the PlayStream event is generated. Not sure if this is intended behaviour or not.
dataPlayStream
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

·
Seth Du avatar image
Seth Du answered

When it is hosted locally, there is no server component to generate the built-in event. If you do want to generate an event, theoretically it is possible to modify the source code to realize it.

But normally, we may just call PlayFab API to write an event if necessary. I am not an expert on Azure, but will try to confirm if it is feasible to enable generating PlayFab events when in the local environment.

10 |1200

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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