Tanoda
pb_GameObjectEditor.cs
Go to the documentation of this file.
1using UnityEngine;
2using System.Collections;
3using System.Reflection;
5
6namespace GILES.Interface
7{
9 {
10 private GameObject _go;
11
12 protected override void InitializeGUI()
13 {
14 _go = ((Transform) target).gameObject;
15
16 pb_GUIUtility.AddVerticalLayoutGroup(gameObject);
17
18 pb_TypeInspector enabled_inspector = pb_InspectorResolver.GetInspector(typeof(bool));
19
20 enabled_inspector.Initialize("Enabled", UpdateEnabled, OnSetEnabled);
21 enabled_inspector.onValueBeginChange = () => { Undo.RegisterState( new UndoReflection(_go, "enabled"), "GameObject Enabled" ); };
22 enabled_inspector.transform.SetParent(transform);
23 }
24
25 object UpdateEnabled()
26 {
27 return _go.activeSelf;
28 }
29
30 void OnSetEnabled(object value)
31 {
32 _go.SetActive((bool) value);
33 pb_ComponentDiff.AddDiff(target, "enabled", _go.activeSelf);
34 }
35 }
36}
Component target
The UnityEngine.Component being edited.
static void AddDiff(Component component, string name, object value)
static void RegisterState(IUndo target, string message)
Definition: Undo.cs:214