public override void OnInspectorGUI() { this.serializedObject.Update(); // base.OnInspectorGUI(); ReorderableListUtil.Draw(list); this.serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { this.serializedObject.Update(); // base.OnInspectorGUI(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Lua Script", GUILayout.Width(100)); self.luaScript = EditorGUILayout.ObjectField(self.luaScript, typeof(TextAsset), false) as TextAsset; EditorGUILayout.EndHorizontal(); ReorderableListUtil.Draw(list); this.serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { ReorderableListExample reorderableListExample = (ReorderableListExample)target; serializedObject.Update(); DrawDefaultInspector(); if (reorderableListExample.showList) { ReorderableListUtil.Draw(list); } serializedObject.ApplyModifiedProperties(); }
void Awake() { controller = (ViewStateController)target; visibleOnIcon = EditorGUIUtility.IconContent("animationvisibilitytoggleon"); visibleOffIcon = EditorGUIUtility.IconContent("animationvisibilitytoggleoff"); list = new ReorderableList(controller.states, typeof(GameObject), true, true, true, true); ReorderableListUtil.SetColumns(list, new List <ReorderableListColumn <GameObject> > { new ReorderableListColumn <GameObject> { Name = "Id", Width = 20, ItemRenderer = (GameObject state, Rect rect, int index, bool isActive, bool isFocused) => { EditorGUI.LabelField(rect, "" + index); } }, new ReorderableListColumn <GameObject> { Name = "State", WidthRatio = 1, ItemRenderer = (GameObject state, Rect rect, int index, bool isActive, bool isFocused) => { controller.states[index] = (GameObject)EditorGUI.ObjectField(rect, state, typeof(GameObject), true); } }, new ReorderableListColumn <GameObject> { Name = "", Width = 10, ItemRenderer = (GameObject state, Rect rect, int index, bool isActive, bool isFocused) => { EditorGUI.LabelField(rect, ""); } }, new ReorderableListColumn <GameObject> { Name = "", Width = 15, ItemRenderer = (GameObject state, Rect rect, int index, bool isActive, bool isFocused) => { var content = state.activeSelf ? visibleOnIcon : visibleOffIcon; var r = new Rect(rect); r.y += 4; var b = GUI.Toggle(r, state.activeSelf, content, GUIStyle.none); if (b != state.activeSelf && b) { controller.SetState(state); } } } }); }
private void OnEnable() { var p = this.serializedObject.FindProperty("injections"); list = ReorderableListUtil.Create(p, new List <ReorderableListUtil.Column>() { new ReorderableListUtil.Column() { DisplayName = "Name", Width = 60 }, new ReorderableListUtil.Column() { DisplayName = "GameObject" }, } , 10); }
private void OnEnable() { list = ReorderableListUtil.Create(serializedObject, "My List", "dataList", new string[] { "name", "toggle" }); }