Hello, I'm trying to pass a string value in through the Function Parameter on ExecuteCloudScriptRequest. On my computer in Unity, everything works perfectly. However, when I build and test on mobile, the Cloudscript is called and executes, but the args in CloudScript is always empty/null. I'm just calling the default "helloWorld" function from Playfab's documentation (https://learn.microsoft.com/en-us/gaming/playfab/features/automation/cloudscript/writing-custom-cloudscript) for testing, but the Function Parameter is not passing its value. I've checked on mobile as well that a string is being set to the Function Parameter. I'm not getting any error messages either. Is there something more I need to do for mobile to pass an args?
#Cloudscript (legacy) args is always empty on call from mobile
3 messages · Page 1 of 1 (latest)
ended up finding a solution in changing how I passed in the FunctionParameter. For some reason I'm still not entirely sure of, writing it like this:
FunctionParameter = new { inputValue = "YOUR NAME" },
based on the documentation was not working for me when I built to android.
This, however, worked for me:
[System.Serializable]
public class FuncParam
{
public string name = "test";
public FuncParam(string name)
{
this.name = name;
}
}
public class Main : MonoBehaviour {
void Start()
{
StartCloudHelloWorld();
}
private void StartCloudHelloWorld()
{
FuncParam funcParam = new("Test");
var request = new ExecuteCloudScriptRequest()
{
FunctionName = "helloWorld", // Arbitrary function name (must exist in your uploaded cloud.js file)
FunctionParameter = funcParam, // The parameter provided to your function
GeneratePlayStreamEvent = true, // Optional - Shows this event in PlayStream
};
PlayFabClientAPI.ExecuteCloudScript(request, OnCloudHelloWorld, OnErrorShared);
}
}
hope this helps anyone else who comes across the problem in the future