We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
public class TestPatch : MonoBehaviour { private void Update() { if (Input.GetKeyDown(KeyCode.Space)) { CallOneAsync("hello"); } } [Patch] public async void CallOneAsync(string name) { Debug.Log(name); await Task.Delay(1000); Debug.Log("TestTask"); } }
这样子写是不会等待一秒之后执行Debug.Log("TestTask"); 但是像下面这样操作的话就可以正常执行
public class TestPatch : MonoBehaviour { private void Update() { if (Input.GetKeyDown(KeyCode.Space)) { CallOneAsync("hello"); } } [Patch] public async void CallOneAsync(string name) { Debug.Log(name); await TestTask(); } private async Task TestTask() { await Task.Delay(1000); Debug.Log("TestTask"); } }
The text was updated successfully, but these errors were encountered:
我遇到了同样得问题,一旦遇到await,代码执行顺序就会错乱
Sorry, something went wrong.
No branches or pull requests
这样子写是不会等待一秒之后执行Debug.Log("TestTask");
但是像下面这样操作的话就可以正常执行
The text was updated successfully, but these errors were encountered: