An interactive panel with persistent storage
With Immediate Mode, we have to store the values of interactive controls like buttons and text inputs at the time we display them. Also, we need to decide if, and when, to persistently store values to be remembered when the panel is out of focus or closed.
In this recipe, we display a text label saying hello to the player and using their name if it has been found in the EditorPrefs
storage. We also offer a text input and a button and, when the button is clicked, we update the name being greeted:

How to do it...
To offer an interactive panel with persistent storage, follow these steps:
- In the
Project
panel, create a newEditor
folder. - In your new
Editor
folder, create a new C# script-class namedWelcome.cs
containing the following:
using UnityEditor; using UnityEngine; public class Welcome : EditorWindow { private string playerName = ""; private string tempName = ""; [MenuItem("Welcome/Hello Player")] public static void ShowWindow...