DisplayDialog can only be called from the main thread
I have a LoginUI extends from MonoBehaviour, and login-button's listener will connect to my server, and when I use EditorUtility.DisplayDialog() in the callback async function, errors showed:
DisplayDialog can only be called from the main thread. Constructors and field initializers will be executed from the loading thread when loading a scene. Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function. UnityEditor.EditorUtility:DisplayDialog(String, String, String)
If I move EditorUtility.DisplayDialog() to Start() funtion, it works fine. Why EditorUtility.DisplayDialog() could not used normally ? it's a static function, why limits its usage? other solutions? I just want to show dialog or tips when login failed.