- Home /
Question by
sschnoor · Mar 24, 2019 at 07:35 PM ·
graphicsuser interfacedisplaypop-up
Is there any method like UnityEditor.EditorUtility.DisplayDialogue that would work on an app you push to an Android?
The dealio is this: I really like this functionality, and I want to make one of these pretty user interaction boxes for when said beloved user F's up on the log in screen.
https://docs.unity3d.com/ScriptReference/EditorUtility.DisplayDialog.html
However, this method eventuates a compile error when I try to push my app to my phone (wont even build me an .apk file! .-. )
AND SO i need a way to do exactly this but ..like...not restricted to build&run in the editor
Example of my script and how I am using the EditorUtility.DisplayDialogue
follows:
public void LoginButton()
{
bool usernameGood = false;
bool passwordGood = false;
if (usernameLogin != "")
{
storedUsername = PlayerPrefs.GetString("Username");
if (storedUsername == usernameLogin)
{
usernameGood = true;
}
else
{
Debug.LogWarning("Username Invaild");
EditorUtility.DisplayDialog("Login Failed", "Username Incorrect", "Ok");
}
}
else
{
Comment
Answer by Voodoomedia · Apr 02, 2020 at 11:23 PM
Just put editor code inside this notation:
#if (UNITY_EDITOR)
... your class/code ...
#endif