Hi. I have been trying this for days now and never manage to properly get my Args transmitted into CloudCode:
I want only a minimum viable test, so that I have something to start with.
Let's say I have a .cs with "TestCloudCode".
`public async void TestCloudCode()
{
var parameters = new Dictionary<string, object>
{
{ "targetPlayerId", "Player123" },
{ "sectorKey", "Sector01" },
{ "damageAmount", 10 }
};
try
{
var result = await CloudCodeService.Instance.CallEndpointAsync<Dictionary<string, object>>(
"Test", // endpoint name
parameters // this dictionary must be serializable
);
Debug.Log("Cloud Code executed successfully: " + result["success"]);
Debug.Log("Returned args: " + (result.ContainsKey("received") ? result["received"] : "none"));
}
catch (System.Exception e)
{
Debug.LogError("Cloud Code error: " + e);
}
}`
Where is this wrong? Endpoint is 100% correct name, I get the Executed Successfully message, but my Cloud Code doesn't write any logs, and I am getting insanely desperate..
My Test CloudCode Script is:
`module.exports = async (args, context) => {
// This will log all incoming arguments
console.log("Received args: " + JSON.stringify(args));
return {
success: true,
receivedArgs: args
};
};`
I would be so so happy if someone told me what I have to do. The idea is to write to trigger as Player A writing into Player B public key Cloud Save Data after calling the "Test" function, that would be the next step.
If there's any example I'll be very helpful, AI officially lost my trust in this regard 😄