Documentation for the Unity C# Library
Loading...
Searching...
No Matches
TextInputDialogue.cs
Go to the documentation of this file.
1using System;
2using Sirenix.OdinInspector;
3#if UNITY_EDITOR
4using Sirenix.OdinInspector.Editor;
5#endif
6using UnityEngine;
7
9{
10#if UNITY_EDITOR
11 public class TextInputDialogue : OdinEditorWindow
12 {
13 [HideInInspector] public Action<string> onClose;
14
15 public static void ShowDialogue(string message, Action<string> onClose)
16 {
17 var window = GetWindow<TextInputDialogue>(true, message, true);
18 window.onClose = onClose;
19 }
20
21 public string text;
22
23 [Button(ButtonSizes.Small)]
24 public void OK()
25 {
26 onClose?.Invoke(text);
27 Close();
28 }
29 }
30#endif
31}