Sometimes, we want to create and display a new panel as part of an Editor Extension. In this recipe, we create a menu item that creates and displays a new panel, displaying some text information:
Displaying a panel with text data
How to do it...
To display a panel with text data, follow these steps:
- In the Project panel, create a new folder, Editor.
- In your new Editor folder, create a new C# script-class named InformationPanel.cs, containing the following:
using UnityEditor;
using UnityEngine;
public class InformationPanel : EditorWindow
{
[MenuItem("My Game/Info Panel")]
public static void ShowWindow()
{
GetWindow<InformationPanel>("My Game", true);
}
private void...