I'm trying to make my method wait for the execution of the GetValueAsync method.
public async Task DownloadTopScoreAsync()
{
await reference.GetValueAsync().ContinueWith(task =>
{
if (task.IsFaulted)
{
Debug.Log("error");
}
else if (task.IsCompleted)
{
DataSnapshot snapshot = task.Result;
// Do something with snapshot...
Debug.Log("hit");
}
});
return;
}
I tried everything, I even copied the ready-made code. But it still gives errors.
CS0433 The type 'Task' exists in both 'Unity.Tasks, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
CS0126 An object of a type convertible to 'Task' is required
CS1061 'Task' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'Task' could be found (are you missing a using directive or an assembly reference?)