Hello,
I’m currently using this REST CLIENT Rest Client for Unity | Network | Unity Asset Store to make calls to a server, data is returned as JSON.
Is it possible to return the data to a calling method from another class?
e.g.
Class A has a method that calls Class B, Class B calls server, then returns data to class A.
Example code to Post data to server, I want response to be sent back to calling method, is this possible?
RestClient.Post(URL.player, JsonUtility.ToJson(sessionData)).Then(data => {
JSON.Session.Return JSONReturn = JsonUtility.FromJson<JSON.Session.Return>(data.Text);
Debug.Log(data.Text);
}).Catch(err => {
Debug.Log(err.Message);
});
Any help would be much appreciated. Thank you.