Hi all,
I’ve done a good amount of reading on coroutines and have used c# async await logic before but can’t seem to get either to work in the context of a unity project.
Here is my calling function:
public IEnumerator LinkAndStart(){
ParseScript._parseInstance.GetUserObjectId(nameInputField.text, Convert.ToInt32(pinInputField.text), pinInputField.text);
//I need to wait until the above completes before loading the next scene
StartCoroutine(LoadScene());
.....
}
Here is the func that contains a Parse sdk aync query
public void GetUserObjectId(string username , int pin, string pinnumber)
{
var query = ParseObject.GetQuery("UniqueID")
//var query = ParseObject.GetQuery("Users")
.WhereEqualTo("PIN", pinnumber);
//Task queryTask = query.FindAsync().ContinueWith(t => {
query.FindAsync().ContinueWith(t => {
IEnumerable<ParseObject> results = t.Result;
....... I want to return a success(true) or failure (false) based on the result of this query
}
Now I’ve tried calling the GetUserObjecId as a Coroutine, but I get an error because you cannot put yield returns inside anonymous blocks (the parse sdk query).
I guess I’m just a little confused how I can wait for this function call to complete and return a status to the caller. Running how it is now, I’d assume that unity would wait until the called method returns, but breakpoints i have in the return statements of the query never get hit.
Any ideas?