[Asset] uGUI Message Box Modal Dialog and Menu

This is a message box and menu system for the new uGUI system in Unity 4.6.

As simple and easy to use as writing MessageBox.Show(“Your message here!”); anywhere in your code.

Web Demo
Online Manual

Features

  • Fully customizable prefabs.
  • Single prefabs are instantiated to maximize simplicity.
  • Similar API to the traditional .net WinForms MessageBox.
  • Generate quick and flexible menus from code for pause menu, save and load game menus, options, etc.
  • Modal dialog that block all other GUI input until the user selects an option, using dimmers that can be configured in the prefabs.
  • Commented C# source code included.

It was rejected from the Asset Store for requiring a beta version of Unity, but I figured I’d post it here to see if anyone was interested in purchasing it early. Please reply or message me.

5 Likes

Here are some additional screenshots:

Here’s how the asset is used:

1 Like

Cool message box system :slight_smile:

Thanks Tim. If it does well I can’t wait to add more controls.

Very nice work!

I forgot to mention the price. I’ll be selling it for $10 in the asset store, but if anyone wants to try it now I’ll send them a free copy.

I’ve sent it to a few people now. If you’d like to try it, be sure to include your email when you message me.

very interesting !!

The asset has now been released. Check it out over at: Unity Asset Store - The Best Assets for Game Making

glad to see it on the asset store im still using the “beta version” that was free but i will be picking this up again great work

I just bought your asset and it works fine so far. The only thing I am missing is the lack for internationalisation. I don’t want to make changes that will be overwritten on the next update.

An easy way could be providing a member variable:

public static Dictionary<DialogResult, string> labelDict = new Dictionary<DialogResult, string> ();

Fill this with English defaults in the static constructor and just read the label text from this dictionary. A user can then provide his own dictionary. Not very sophisticated but pretty quick to implement.

Bump: Seems like contacting the developer is not that easy and I have to do the changes on my own.

Hi Kay,

Sorry for not getting back to you.

I’ve implemented a hook for you and emailed you a new build.

Instead of adding a new string table I just created a localize function hook that get’s called on the strings. I figure it’s easier for the developers to keep all their strings in their existing systems.

Here’s how it works:

        MessageBox.Localize =
            (originalString) =>
            {
                // You would normally hook into your existing localization system here to lookup and return a translated string using the original as a key.
                // For instance using "Localization package" from the asset store you would do this:
                // return Language.Get(originalString);

                // Current text strings that need to be localized are "OK", "Yes", "No", "Cancel", "Abort", "Retry", "Ignore"

                // This function only needs to be set once at game startup.

                // For test example replace the original string with X's, so "Hello World" becomes "XXXXXXXXXXX"
                return new String('X', originalString.Length);
            };

Will that work well for you?

One other question, would you like me to call that localize function on all the text that is sent to the message box, so that you don’t have to remember to localize the message and title text? I don’t think it would hurt if the text got sent thru the function twice on accident.

Bryan

I just created a flag to let you control the localizing of the message and title text like this:

        // Set LocalizeTitleAndMessage to true to send the title and message of message boxes and menu boxes thru the Localize function.
        MessageBox.LocalizeTitleAndMessage = true;

I’ll submit the new version to the asset store now.

I’ve also received a feature request to create a set of dialogs that can contain a number spinner, text input field, and name and password fields. Would anyone else here use those?

Thank you for the support and I apologize once again for the delay.

Bryan

Yes that’s cool so everything can be connected to arbitrary localisation systems and the calling code only operates with keys.

“Yeah, I need all cool stuff” would be the typical answer :wink: But to be honest I don’t need it - at the moment. On the long run I think these are exciting features to make modal dialogs an even more powerful tool. Regarding the text input field it would be great to consider different input types like email, phone,… Especially on mobile devices it is very useful to get the corresponding keyboard layout popping up.

Are these modal popup windows compatible with iOS and Android and Blackberry?

I haven’t tried them but they should work fine.

I used them on iOS and Android - working fine

Okay great… Just purchased!

A few questions:

Can I make a truly modal box that disables all other input/clicks on elements underneath?
EDIT: Never mind… I think it does this by default.

How do I center the box? The box appears in the bottom half but I want it up in the center.

How do I change the size of the box?

Can I change the colors of the box?

How do I customize the text on the buttons?

Thanks