Language
Edit

Dialog Class

Definition

The Dialog script hydrates and controls the various sub-components of the dialog view.

[UnityEngine.AddComponentMenu("MRTK/UX/Dialog")]
public class Dialog : UnityEngine.MonoBehaviour, MixedReality.Toolkit.UX.IDialog
[<UnityEngine.AddComponentMenu("MRTK/UX/Dialog")>]
type Dialog = class
    inherit MonoBehaviour
    interface IDialog
Public Class Dialog
Inherits MonoBehaviour
Implements IDialog
Inheritance
UnityEngine.MonoBehaviour
Dialog
Attributes
UnityEngine.AddComponentMenuAttribute
Implements

Remarks

Dialogs are typically spawned, pooled, and destroyed by DialogPools. Generally, developers should not directly manage or instantiate instances of their dialogs, as it is essential that they are pooled and managed correctly by a coordinator.

Constructors

Name Description
Dialog()

Properties

Name Description
OnDismissed

This event is fired when the dialog is dismissed, either through user inaction, or by some other foreground action taking precedence.

VisibleRoot

The dialog's root Unity game object, used for setting visibility.

Methods

Name Description
Awake()

A Unity event function that is called when an enabled script instance is being loaded.

Dismiss()

Dismisses the dialog. Unsubscribes all listeners from the dialog's events, plays the dismiss animation, and then invokes OnDismissed immediately.

Reset()

Clears all content, events, and configuration from the dialog. Useful when pooling Dialog objects, to ensure that subsequent uses of the object don't retain stale data.

SetBody(String)

Sets the body text on the dialog.

SetHeader(String)

Sets the header text on the dialog. This is generally displayed in a more prominent position and/or with more prominent styling than the body text.

SetNegative(String, Action<DialogButtonEventArgs>)

Adds a negative option on the Dialog. action will be invoked when the option is selected. label will be affixed to the associated button.

SetNeutral(String, Action<DialogButtonEventArgs>)

Adds a neutral option on the Dialog. action will be invoked when the option is selected. label will be affixed to the associated button.

SetPositive(String, Action<DialogButtonEventArgs>)

Adds a positive option on the Dialog. action will be invoked when the option is selected. label will be affixed to the associated button.

Show()

Shows this IDialog object. Call this method after the content and actions have been specified with the fluent methods.

ShowAsync()

An asynchronous operation that returns a DialogDismissedEventArgs that represents the result of the user's choice. The task will complete once the dialog dismissed, either by user action or by some other foreground action. If the user does not select an option, the Choice property will be null.

Applies to