public void ShowNotification (GUIContent notification);

Parameters

notificationThe contents of the notification message.
fadeoutWaitThe duration the notification is displayed. Measured in seconds.

Description

显示通知消息。

在窗口上显示通知消息。与消息框或日志消息不同,通知会在一段时间后自动消失。 调用 RemoveNotification 可立即删除通知。


Show a notification in an editor window.

using UnityEngine;
using UnityEditor;

public class ShowRemove : EditorWindow { string notification = "This is a Notification";

[MenuItem("Example/Notification Usage")] static void Initialize() { ShowRemove.GetWindow(typeof(ShowRemove)); }

void OnGUI() { if (GUILayout.Button("Show Notification")) { this.ShowNotification(new GUIContent(notification)); }

if (GUILayout.Button("Remove Notification")) { this.RemoveNotification(); } } }