/// <summary> /// Shows an alert dialog with 2 buttons. /// </summary> /// <returns>The two buttons alert.</returns> /// <param name="title">Title.</param> /// <param name="message">Message.</param> /// <param name="button1">Button1.</param> /// <param name="button2">Button2.</param> internal static MobileNativeAlert ShowTwoButtonAlert(string title, string message, string button1, string button2) { #if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR if (Instance != null) { return(null); // only allow one alert at a time } // Create a Unity game object to receive messages from native side Instance = new GameObject(ALERT_GAMEOBJECT).AddComponent <MobileNativeAlert>(); // Show the native platform-specific alert #if UNITY_IOS iOSNativeAlert.ShowTwoButtonsAlert(title, message, button1, button2); #elif UNITY_ANDROID AndroidNativeAlert.ShowTwoButtonsAlert(title, message, button1, button2); #endif return(Instance); #else // Platform not supported if (Debug.isDebugBuild) { Debug.Log("Show 2-button alert with message: " + message); } return(null); #endif }
/// <summary> /// Shows an alert dialog with 2 buttons. /// </summary> /// <returns>The two buttons alert.</returns> /// <param name="title">Title.</param> /// <param name="message">Message.</param> /// <param name="button1">Button1.</param> /// <param name="button2">Button2.</param> internal static AlertPopup ShowTwoButtonAlert(string title, string message, string button1, string button2) { #if UNITY_EDITOR Debug.Log("Show 2-button alert with message: " + message); return(null); #elif UNITY_IOS if (Instance != null) { return(null); // only allow one alert at a time } // Create a Unity game object to receive messages from native side Instance = new GameObject(ALERT_GAMEOBJECT).AddComponent <AlertPopup>(); // Show iOS 2-button alert iOSNativeAlert.ShowTwoButtonsAlert(title, message, button1, button2); return(Instance); #elif UNITY_ANDROID if (Instance != null) { return(null); // only allow one alert at a time } // Create a Unity game object to receive messages from native side Instance = new GameObject(ALERT_GAMEOBJECT).AddComponent <AlertPopup>(); // Show Android 2-button alert AndroidNativeAlert.ShowTwoButtonsAlert(title, message, button1, button2); return(Instance); #else Debug.Log("Native alert is not supported on this platform."); return(null); #endif }