question

Vasya Pupkin avatar image
Vasya Pupkin asked

Send FunctionParameter in library

So far I have not needed to send data to the "cloud".

It is necessary to send FunctionParameter Object file which is realized in Jnson?

I need to learn how to send the object file for Unity from the library


Which object? I already tried the options
1.String.String Array
2.String
3.Txt
4.Jnson


How exactly to draw up the data inside the object and which object?
I tried so many options.
Nothing worked out for me

Here is a script, this is a test one. It works, but returns a helloworld debug log: without "inputValue".

Where am I wrong? Help modify the script so that I can understand if my sending method works at all.

Or does he not see what he needs in the line? new {inputValue = "YOUR NAME"}

Help me write a script that will help me understand if the cloud script accepts the data, what it is, what is wrong with them.

Something is sent exactly, because if you send an empty object, the script swears at empty variables


handlers.helloWorld = function (args, context) {var message = "Hello " + currentPlayerId + "!";log.info(message);     var inputValue = null;     if (args && args.inputValue)         inputValue = args.inputValue;     log.debug("helloWorld:", { input: args.inputValue });   return { messageValue: message };
};
unity3dCloudScript
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

·
Citrus Yan avatar image
Citrus Yan answered

I am assuming that you are following this tutorial: https://docs.microsoft.com/en-us/gaming/playfab/features/automation/cloudscript/writing-custom-cloudscript

The args field in the CloudScript handler, in this case – the helloWorld handler, is parsed from the FunctionParameter field sent by the client. Basically, FunctionParameter contains a series of key/value pairs indicating the name of the parameter and its value. I followed the aforementioned tutorial and can see that the “helloworld” debug log did return “inputValue”, however, in this format:

{
                
"Message": "helloWorld:",
"Level": "Debug",
"Data": {
"input": "YOUR NAME"
}
}

I don’t see the problem of it.

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.