public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { using (new EditorGUI.PropertyScope(position, label, property)) { AnimatorHelp help = property.serializedObject.targetObject as AnimatorHelp; if (help != null) { foreach (ParaEnum value in Enum.GetValues(typeof(ParaEnum))) { if (help.GetSelectedData(value)) { var para = property.FindPropertyRelative(value.ToString()); EditorGUILayout.PropertyField(para); } } } } }
private void ChangeTransitionData() { foreach (KeyValuePair <AnimatorStateTransition, bool> pair in _help.TransitionsDic) { if (pair.Value) { foreach (ParaEnum value in Enum.GetValues(typeof(ParaEnum))) { if (_help.GetSelectedData(value)) { var to = pair.Key.GetType().GetProperty(value.ToString()); var from = _help.TransitionPara.GetType().GetField(value.ToString()); to.SetValue(pair.Key, from.GetValue(_help.TransitionPara)); } } } } EditorUtility.DisplayDialog("", "修改完成", "是"); }