Unity3d Calling modal dialog box/unity3d MessageBox

Source: Internet
Author: User

Unity modal dialog box/unity MessageBox

Many times, we need to publish the EXE product of unity to a certain platform. For example, so-and-so landlord published to a Q game.
This time if you need to debug swollen. There is no way out of that.
1: Source debugging, the premise is that the entire system is your home company.
2: Additional process, to start running the game, in the MonoDevelop to carry out additional process debugging, if not completed, this is also very egg pain.
3: Log, Unity log function very slag, a little attention will appear the log content character confusion, stays, the long log to find inside
Capacity, the incomparable egg ache, the most pit father is not necessarily in the final collapse time can successfully record the message.
4: This focus AH:MessageBox, refreshing modal dialog box, this thing can be achieved, only in the event of abnormal modal dialog box,

Lock program process, other times the program casually run ... Here's the start:

How to use, the MessageBox exists in the System.Windows.Forms.dll, this thing please crossing do not miss Ah.
Put it in Unity Project assets/plugins/This time the program will automatically add the reference.
The next step is to change the playersettings Api compatibility level in unity to NET2.0.
This way, Lennon can be in the program using.
Class conflicts are prompted in some places after using "using System.Windows.Forms.MessageBox". such as the application class;
This time can use "using Msgboxbase = System.Windows.Forms.MessageBox" substitution, the author is so make use of it;

You can use the MessageBox bird at a time. Let's see what he has to offer us.

==============================================================

Namespace System.Windows.Forms
{
public class MessageBox
{
public static DialogResult Show (string text);
public static DialogResult Show (IWin32Window owner, string text);
public static DialogResult Show (string text, string caption);
public static DialogResult Show (IWin32Window owner, string text, string caption);
public static DialogResult Show (string text, string caption, MessageBoxButtons buttons);
public static DialogResult Show (IWin32Window owner, string text, string caption, MessageBoxButtons buttons);
public static DialogResult Show (string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon);
public static DialogResult Show (IWin32Window owner, string text, string caption, MessageBoxButtons buttons, Messageboxico n icon);
public static DialogResult Show (string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, Messageboxde Faultbutton DefaultButton);
public static DialogResult Show (IWin32Window owner, string text, string caption, MessageBoxButtons buttons, Messageboxico n icon, MessageBoxDefaultButton DefaultButton);
public static DialogResult Show (string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, Messageboxde Faultbutton DefaultButton, messageboxoptions options);
public static DialogResult Show (IWin32Window owner, string text, string caption, MessageBoxButtons buttons, Messageboxico n icon, MessageBoxDefaultButton DefaultButton, messageboxoptions options);
}
}

==============================================================

This way, you can

if (5<6) {

Msgboxbase.show ("Unity of the Lord, the post and successfully spread the knowledge bird!") ", this. GetType (). Name, WinForms.MessageBoxButtons.OK, WinForms.MessageBoxIcon.Error);

}

In this way, you can just jump out of the modal dialog box for exception errors in the program, and you don't close, and the program will be waiting for you honestly.

MessageBoxButtons Enumeration Reference:

Http://msdn.microsoft.com/zh-cn/library/system.windows.forms.messageboxbuttons%28v=vs.110%29.aspx

MessageBoxIcon Enumeration Reference:

Http://msdn.microsoft.com/zh-cn/library/system.windows.forms.messageboxicon.aspx

Unity3d Calling modal dialog box/unity3d MessageBox

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.