public override void OnInspectorGUI() { serializedObject.Update(); DrawBase(); EditorGUILayout.Space(); EditorGUILayout.PropertyField(serializedObject.FindProperty("_Target")); SerializedProperty tweenMoveTypeProperty = serializedObject.FindProperty("_TweenMoveType"); EditorGUILayout.PropertyField(tweenMoveTypeProperty); TweenMoveType tweenMoveType = EnumUtility.GetValueFromIndex <TweenMoveType>(tweenMoveTypeProperty.enumValueIndex); switch (tweenMoveType) { case TweenMoveType.Absolute: case TweenMoveType.Relative: EditorGUILayout.PropertyField(serializedObject.FindProperty("_From")); break; case TweenMoveType.ToAbsolute: break; } EditorGUILayout.PropertyField(serializedObject.FindProperty("_To")); serializedObject.ApplyModifiedProperties(); }
void DrawElement(Rect rect, int index, bool isActive, bool isFocused) { SerializedProperty blendShapeProperty = _BlendShapeList.serializedProperty.GetArrayElementAtIndex(index); GUIContent label = EditorGUI.BeginProperty(rect, EditorGUITools.GetTextContent(blendShapeProperty.displayName), blendShapeProperty); rect.height = _BlendShapeList.elementHeight; EditorGUI.PrefixLabel(rect, label); rect.y += rect.height + EditorGUIUtility.standardVerticalSpacing; SerializedProperty targetProperty = blendShapeProperty.FindPropertyRelative("_Target"); rect.height = EditorGUI.GetPropertyHeight(targetProperty); EditorGUI.PropertyField(rect, targetProperty); rect.y += rect.height + EditorGUIUtility.standardVerticalSpacing; SerializedProperty nameProperty = blendShapeProperty.FindPropertyRelative("_Name"); rect.height = EditorGUI.GetPropertyHeight(nameProperty); EditorGUI.PropertyField(rect, nameProperty); rect.y += rect.height + EditorGUIUtility.standardVerticalSpacing; SerializedProperty tweenMoveTypeProperty = blendShapeProperty.FindPropertyRelative("_TweenMoveType"); rect.height = EditorGUI.GetPropertyHeight(tweenMoveTypeProperty); EditorGUI.PropertyField(rect, tweenMoveTypeProperty); rect.y += rect.height + EditorGUIUtility.standardVerticalSpacing; SerializedProperty fromProperty = blendShapeProperty.FindPropertyRelative("_From"); TweenMoveType tweenMoveType = EnumUtility.GetValueFromIndex <TweenMoveType>(tweenMoveTypeProperty.enumValueIndex); switch (tweenMoveType) { case TweenMoveType.Absolute: case TweenMoveType.Relative: { rect.height = EditorGUI.GetPropertyHeight(fromProperty); EditorGUI.PropertyField(rect, fromProperty); rect.y += rect.height + EditorGUIUtility.standardVerticalSpacing; } break; case TweenMoveType.ToAbsolute: break; } SerializedProperty toProperty = blendShapeProperty.FindPropertyRelative("_To"); rect.height = EditorGUI.GetPropertyHeight(toProperty); EditorGUI.PropertyField(rect, toProperty); rect.y += rect.height; EditorGUI.EndProperty(); }
float GetElementHeight(int index) { float height = _BlendShapeList.elementHeight + EditorGUIUtility.standardVerticalSpacing; SerializedProperty blendShapeProperty = _BlendShapeList.serializedProperty.GetArrayElementAtIndex(index); SerializedProperty targetProperty = blendShapeProperty.FindPropertyRelative("_Target"); height += EditorGUI.GetPropertyHeight(targetProperty) + EditorGUIUtility.standardVerticalSpacing; SerializedProperty nameProperty = blendShapeProperty.FindPropertyRelative("_Name"); height += EditorGUI.GetPropertyHeight(nameProperty) + EditorGUIUtility.standardVerticalSpacing; SerializedProperty tweenMoveTypeProperty = blendShapeProperty.FindPropertyRelative("_TweenMoveType"); height += EditorGUI.GetPropertyHeight(tweenMoveTypeProperty) + EditorGUIUtility.standardVerticalSpacing; SerializedProperty fromProperty = blendShapeProperty.FindPropertyRelative("_From"); TweenMoveType tweenMoveType = EnumUtility.GetValueFromIndex <TweenMoveType>(tweenMoveTypeProperty.enumValueIndex); switch (tweenMoveType) { case TweenMoveType.Absolute: case TweenMoveType.Relative: { height += EditorGUI.GetPropertyHeight(fromProperty) + EditorGUIUtility.standardVerticalSpacing; } break; case TweenMoveType.ToAbsolute: break; } SerializedProperty toProperty = blendShapeProperty.FindPropertyRelative("_To"); height += EditorGUI.GetPropertyHeight(toProperty); return(height); }