PlayDisplayDialog.cs
using UnityEditor; public class PlayDisplayDialog { [MenuItem("Custom Menu/Play")] public static void Play() { bool playOutput = EditorUtility.DisplayDialog("Play", "Are you sure you want to enter play mode?", "Yes", "No"); if (playOutput) EditorApplication.EnterPlaymode(); else EditorUtility.DisplayDialog("Canceled", "You canceled the play mode.", "OK"); } }