Version: 5.4
public static int DisplayDialogComplex (string title, string message, string ok, string cancel, string alt);

説明

3 つボタンのモーダルダイアログを表示します

エディターでメッセージボックスを表示するにはこれを使用するようにしてください。

Similar to DisplayDialog, only this version shows a dialog with three buttons. ok, cancel and alt/ are labels to be displayed on the buttons. DisplayDialogComplex returns an integer 0, 1 or 2 corresponding to ok, cancel and alt buttons.

関連項目: DisplayDialog 関数


Display dialog complex for the example below.

using UnityEngine;
using UnityEditor;

public class DisplayDlgComplexExample : EditorWindow { // Lets you save, save and quit or quit without saving

[MenuItem( "Example/Enhanced Save" )] static void Init( ) { int option = EditorUtility.DisplayDialogComplex( "What do you want to do?", "Please choose one of the following options.", "Save Scene", "Save and Quit", "Quit without saving" );

switch( option ) { // Save Scene case 0: EditorApplication.SaveScene( EditorApplication.currentScene ); break;

// Save and Quit. case 1: EditorApplication.SaveScene( EditorApplication.currentScene ); EditorApplication.Exit( 0 ); break;

// Quit Without saving. case 2: EditorApplication.Exit( 0 ); break;

default: Debug.LogError( "Unrecognized option." ); break; } }

}