Tanoda
pb_StringInspector.cs
Go to the documentation of this file.
1using UnityEngine;
2using System.Collections;
3using System.Reflection;
4
5namespace GILES.Interface
6{
10 [pb_TypeInspector(typeof(string))]
11 public class pb_StringInspector : pb_TypeInspector
12 {
13 string value;
14
15 public UnityEngine.UI.Text title;
16 public UnityEngine.UI.InputField input;
17
18 public override void InitializeGUI()
19 {
20 title.text = GetName().SplitCamelCase();
21#if UNITY_5_2
22 input.onValueChange.AddListener( OnValueChange );
23#else
24 input.onValueChanged.AddListener( OnValueChange );
25#endif
26 }
27
28 protected override void OnUpdateGUI()
29 {
30 value = GetValue<string>();
31 input.text = value != null ? value.ToString() : "null";
32 }
33
34 public void OnValueChange(string val)
35 {
36 SetValue(val);
37 }
38 }
39}
UnityEngine.UI.InputField input