Aimon Z. Asked:2020-02-01 01:27:43 +0000 UTC2020-02-01 01:27:43 +0000 UTC 2020-02-01 01:27:43 +0000 UTC 如何排队唤醒的 772 我有几个脚本,一个在Awake中解析xml,将值输入到Dictionary中,另外一个在Awake中也获取这个Dictionary的值,以及如何让一个Awake等待另一个 Awake 在加载 Xml 时,然后才从 Awake 中获取价值? c# 1 个回答 Voted Best Answer Valera Kvip 2020-02-01T02:28:59Z2020-02-01T02:28:59Z 在 Unity 中,您可以自定义脚本执行的顺序: https ://docs.unity3d.com/ru/current/Manual/class-ScriptExecution.html 由于 Awake 在一个线程中执行,因此一个线程将等待另一个线程。在这种情况下,应用程序将挂起,直到它读取所有数据。 最好在另一个线程或协程中执行此操作。 https://docs.unity3d.com/en/current/Manual/Coroutines.html 例如,通过事件将您的脚本与回调连接起来。 https://docs.microsoft.com/en-us/dotnet/standard/events/ 当一个脚本完成阅读时,它将通知另一个脚本。
在 Unity 中,您可以自定义脚本执行的顺序: https ://docs.unity3d.com/ru/current/Manual/class-ScriptExecution.html
由于 Awake 在一个线程中执行,因此一个线程将等待另一个线程。在这种情况下,应用程序将挂起,直到它读取所有数据。
最好在另一个线程或协程中执行此操作。 https://docs.unity3d.com/en/current/Manual/Coroutines.html
例如,通过事件将您的脚本与回调连接起来。
https://docs.microsoft.com/en-us/dotnet/standard/events/
当一个脚本完成阅读时,它将通知另一个脚本。