Returning a value to Unity from Custom Business Logic

Hey!

I’m having a problem with getting a result (string) from custom business logic to Unity client. I am using the unofficial Backendless Unity SDK (https://github.com/Backendless-Game-SDK/Unity-SDK).

In Backendless I have a file under Business Logic -> Hosted. In this file i have a method called “SayHello” that returns a String. The method is listed and works in API Inspector. The response body being “Hello”.

My question is how can I get this string in the Unity client application.
Below is the type of event dispatch I am trying to use to retrieve the data. I get the response:
received result - System.Collections.Generic.Dictionary`2[System.String,System.Object]
but the size of the IDictionary is 0. I have tried using other types of objects and variables instead of the IDictionary, such as Array or Map, but the result is always the same. String gives straight out an error if placed in the callback.
If you think the returned string value is somewhere in the IDictionary statement, how can I get to it?

Thank you in advance,
Larri

AsyncCallback<IDictionary> callback = new AsyncCallback<IDictionary>(
        result =>
        {
            Debug.Log("received result - " + result);
        },
        fault =>
        {
            Debug.Log("Error - " + fault);
        });
        
        Backendless.Events.Dispatch("SayHello", null, callback);

The SDK you’re using is not officially supported by us. Have you tried debugging the SDK code to see why it represents the value as a dictionary?

Hey! We dropped this sdk and now we use Rest/http requests from Unity.

We hope the Backendless Unity Sdk will be out soon :slight_smile:

Btw, is there a way to distinguish a call from Unity mobile app and command line, so we could block the last one?

Thank you for your reply, Mark! As Juha mentioned, we are minimalizing the use of the SDK from now on, so this isn’t an issue anymore.

You can block access based on the secret API key used along with the requests.