I want to use dialog boxes (having two options).
I tried UnityEditor, but when I create a project to create an exe file, it does not work, because scripts containing UnityEditor links just work in edit mode. After searching the Internet for hours, there were two sentences (both did not work).
First one . Using #if UNITY_EDITOR before the code and ending with #endif . In this case, it was built without errors, but there were no dialog boxes in my game.
Second one . Place the script in the Assets / Editor directory. In this case, I could not add a script to my game object. Perhaps by creating a new script in the "Editor" section and inserting the lines used by UnityEditor, it would work, but I could not figure out how to do this.
I used:
#if UNITY_EDITOR if (UnityEditor.EditorUtility.DisplayDialog("Game Over", "Again?", "Restart", "Exit")) { Application.LoadLevel (0); } else { Application.Quit(); } #endif
I also tried adding “using UnityEditor” and encapsulating it with the preprocessor command that I mentioned. It is also useless.
Does anyone know how to use UnityEditor in startup mode or how to create dialogs differently?
c # dialog unity3d
Mustafa Orkun Acar
source share