question

contact avatar image
contact asked

UE4 C++ SDK FExecuteCloudScriptResult FunctionResult

Can anyone provide an example of how to get the FunctionResult from a FExecuteCloudScriptResult in the UE4 C++ SDK?

void UShooterGameInstance::OnExecuteCloudScriptSuccess(const PlayFab::ClientModels::FExecuteCloudScriptResult& Result) const

{

PlayFab::FMultitypeVar Var = Result.FunctionResult;

FString JsonString = Var.toJSONString();

}

I assume that is not correct and there doesn't seem to be much else on the PlayFab::FMultitypeVar so I'm not sure how to get the function result?

sdks
10 |1200

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

1807605288 avatar image
1807605288 answered

You have found a little-known issue with all of our C++ based SDKs.

Specifically, we can't get the object result back to those SDKs right now.

In the WindowsSdk, I demonstrate how to use the log results to get a string back to the client and evaluate it. In your case, you would want to log the json of the result object you want, and manually deserialize it.

https://github.com/PlayFab/WindowsSDK/blob/dc0dcbf08575985d08fb64280be9ee3a152bd97a/PlayFabSDK/build/VC12/UnittestRunner/PlayFabApiTest.cpp#L547

I totally accept that this is a terrible workaround, and I'm sorry about that. Now that a customer is aware of the problem, I'll bump up the priority of this bug.

3 comments
10 |1200

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

Zhi Kang Shao avatar image Zhi Kang Shao commented ·

I'm currently trying to read a Cloud script's return value in the UE4 C++ SDK. I know the script executes without issues but I can't read a simple string return value on the UE4 end. Has this been fixed?

0 Likes 0 ·
brendan avatar image brendan Zhi Kang Shao commented ·

Not yet, sorry. We're aware of this issue and do want to fix it as soon as we can, but we do have to prioritize based upon the needs of our overall user base, and I'm afraid we've heard from very few people that this is a blocking issue for them. I'm adding you to the tracking for this issue though, to make sure we have a record of this.

0 Likes 0 ·
Zhi Kang Shao avatar image Zhi Kang Shao Zhi Kang Shao commented ·

Thank you for the information. I've managed to work around the issue for now by printing the json object to the log as Paul suggested.

0 Likes 0 ·
gneokleous avatar image
gneokleous answered

@Brendan

@Zhi Kang Shao

@contact


Possible solution that works in the Blueprints SDK. FunctionResult was null as long as my

string array was returned on it's own. When i encapsulated the array as a filed in a JSON object i could access the return value without issues.

All the modifications were made in the cloudscript implementation.

i.e.

wrong:

return xValue;
correct:
var xObject = {};xObject["FieldName"] = xValue;return xObject;
2 comments
10 |1200

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

1807605288 avatar image 1807605288 ♦ commented ·

Yes, you're right. UeBp has limitations, but FunctionResult does work under many circumstances for that SDK.

A while back, we updated the WindowsSdk so it can now retrieve any type of result.

Cocos and UeCpp remain unable to retrieve any data from FunctionResult.

0 Likes 0 ·
unbrokencraig avatar image unbrokencraig commented ·

Was there ever an update on this? I'm trying to get the results of a call to GetRandomResultTables from CloudScript in an Unreal 4 project, and having trouble getting anything out of the FunctionResult.

0 Likes 0 ·

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.