- Home /
Because this call is not awaited, execution of the current method continues
Is there any way to turn this warning off? It seems like such a silly warning and floods the console for each instance where I want the execution of the current method to continue.
Or am I approaching this wrong?
I want to call some functions and then continue executing the current method. In other words, there are some expensive, non-critical, actions I just want to begin processing, but they will not complete in time for the next frame unless I hold up the frame. If I hold up frames, interaction with the game suffers.
So I have I have async functions ready for these tasks. (IE: finding paths, room fill, etc) Example below. When I call these functions, they begin doing work, but they do not hold up the update function. Why am I being warned about this constantly? It seems perfectly logical to me.
public async Task FindPath_async(Tile destination)
{
path = new KeyValuePair<string, Path_AStar>("Searching", null);
path = new KeyValuePair<string, Path_AStar>("Ready", await Task.Run(() => FindPath(destination)));
}
Update(){
if(path.Key == "Available")
FindPath_async(destination); // <--- This is where I get the warning
if(path.Key == "Ready")
FOLLOW PATH
}
Your answer
Follow this Question
Related Questions
LoadLevel Async 2 Answers
Windows 8 - Windows.Storage WriteTextAsync exception 0 Answers
Additively loaded scene gets stuck at 90% even if allowSceneActivation is true. 2 Answers
Can't access AsyncOperation instance to change allowSceneActivation 2 Answers
Task.Wait seems to block Unity forever, Task variable is returned from an Async function 0 Answers