如何使用Azure函数访问读/写/修改/删除Playfab数据?
发布于 2021-12-17 04:19:50
下面的步骤将帮助您使用Playfab访问azure函数
中的azure函数调用云脚本的示例代码。
//This snippet assumes that your game client is already logged into PlayFab.
using PlayFab;
using PlayFab.CloudScriptModels;
private void CallCSharpExecuteFunction()
{
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, object>() { { "inputValue", "Test" } }, //This is the data that you would want to pass into your function.
GeneratePlayStreamEvent = false //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()}");
});
}
PlayFab CloudScript Context, Variables and Server SDKs
dotnet add package PlayFabAllSDK一起发货的助手
,则需要编辑.csproj文件,并在默认的PropertyGroup或NETCOREAPP3_1中包含<DefineConstants>NETCOREAPP2_0</DefineConstants>。

脚本的
。
有关更多信息,请查看Cloud Script Using Azure Functions和Playfab Cloud Script
https://stackoverflow.com/questions/70374253
复制相似问题