Call an alert box from Unity

Hi

I would like to know if there is an implementation to call alert boxes from Unity (C#) or do I have to write a plugin for that?

If you asking if Unity allows you to call native OS alert boxes, then the answer is - you’d need to call narive OS alert boxes using native OS functions.

If you need just an alert box, try to do it with Unity GUI

like this? Unity - Scripting API: EditorUtility.DisplayDialog

use DisplayDialog (title : String, message : String, ok : String) to popup an alert dialog

example:

DisplayDialog (“Title here”, “Your text”, “Ok”);

1 Like

Hi Guys, You can use plugin to show native alert in your unity app/game.

1 Like

Now that’s simple, check out this Free to use plugin It allows you to access native alerts in both iOS n Android platforms.

Surely its too late to be useful for robhuhn**.** But can be informative to others :slight_smile:

1 Like

@VoxelBusters

Downloading the asset screwed something in my project:

Error: System.ArgumentException: An element with the same key already exists in the dictionary.
at System.Collections.Generic.Dictionary`2[System.String,System.String].Add (System.String key, System.String value) [0x00000] in :0
at us.UnityScriptCompilerFactory.FromCommandLineOptions (us.CommandLineOptions options) [0x00000] in :0
at us.UsModule.compile (us.CommandLineOptions options) [0x00000] in :0
at us.UsModule.runWithCommandLine (System.String[ ] commandLine) [0x00000] in :0
at us.UsModule.Main (System.String[ ] argv) [0x00000] in :0

Since the error does not open the faulty script, I have to remove the plugin for the time being. It also required a restart of Unity if that may help.

Dunno if that is conflicting with something else or what could be.

Hey @fafase ,

Sorry for the inconvenience caused. Please go through this discussion, it will help you rectify this issue. And please let us know incase if you still find this issue.

Regards
VB Team

Unfortunately, nothing seems to work here. I’ve tried to make a plugin for iOs and Android, but it was really tedious. To those who want to create their own plugin - just don’t waste your time. It is much easily to spend few dollars for a plugin in Unity Store. For example, I bought Mobile Alert Dialog and it works like a charm. There are few other plugins in the store, maybe you can try them, especially free ones. However, I found them either not working or inconvenient to use.

@Imatorio Would be great if you can review our plugin. Its pretty straight forward to use and cross platform.

Cheers,
VB Team

That namespace isnt operational outside of the editor (hence the name “EditorUtility”). It will run native but when you try to build and push to the Android, it will have a build error and wont even give you your .apk file.

The error says “does not exist in current context”. SOOO any alternatives for a newbie app maker? I just want a message to pop up if they sign in with credentials that are wrong!

1 Like

Hi Guys, I need to display the native alert view using Swift and the Unity As A Library approach.
Have someone any idea how to do that?
Thanks in advance!

Hey, I think can help you.
http://www.theappguruz.com/blog/ios-native-popup-using-unity