private void FuncGroup() { Type = (GUIToggle.AxisType)EditorGUILayout.EnumPopup(Type, GUILayout.MaxWidth(150)); if (Type != Owner.Type) { Owner.TypeChange(Type); } GUILayout.BeginHorizontal(); if (GUILayout.Button("+", GUILayout.MaxWidth(50))) { Selection.activeGameObject = Owner.gameObject; string path = @"Assets/Prefabs/UI/GUICheckMask.prefab"; Object asset = AssetDatabase.LoadAssetAtPath(path, typeof(GameObject)); if (asset != null) { GameObject checkMark = Instantiate(asset) as GameObject; GameObjectUtility.SetParentAndAlign(checkMark, Owner.gameObject); Undo.RegisterCreatedObjectUndo(checkMark, "Create " + checkMark.name); Owner.Add(checkMark.GetComponent <GUICheckMark>()); } } if (GUILayout.Button("-", GUILayout.MaxWidth(50))) { Owner.DestroyLastIndex(); } if (GUILayout.Button("#", GUILayout.MaxWidth(50))) { Owner.Refresh(); } GUILayout.EndHorizontal(); }
protected override void OnEnable() { base.OnEnable(); Owner = (GUIToggle)target; Type = Owner.Type; activeSprite = Owner.ActiveSprite; unactiveSprite = Owner.UnactiveSprite; }
public override void OnInspectorGUI() { base.OnInspectorGUI(); if (!Owner.UIDependent && !Application.isPlaying) { GUILayout.BeginHorizontal(); if (GUILayout.Button("+", GUILayout.MaxWidth(50))) { Owner.Add("new text"); } if (GUILayout.Button("-", GUILayout.MaxWidth(50))) { Owner.EditorDeleteLastIndex(); } axisType = (GUIToggle.AxisType)EditorGUILayout.EnumPopup(Owner.AxisType, GUILayout.MaxWidth(100)); if (axisType != Owner.AxisType) { Owner.AxisTypeChange(axisType); } GUILayout.EndHorizontal(); } }