modular-avatar/Packages/net.fushizen.modular-avatar/Editor/Inspector/MergeArmatureEditor.cs

30 lines
977 B
C#
Raw Normal View History

using System;
using UnityEditor;
using UnityEngine;
namespace net.fushizen.modular_avatar.core.editor
{
[CustomEditor(typeof(ModularAvatarMergeArmature))]
public class MergeArmatureEditor : Editor
{
public override void OnInspectorGUI()
{
var target = (ModularAvatarMergeArmature) this.target;
var priorMergeTarget = target.mergeTargetObject;
EditorGUI.BeginChangeCheck();
base.OnInspectorGUI();
if (EditorGUI.EndChangeCheck())
{
serializedObject.ApplyModifiedProperties();
if (target.mergeTargetObject != null && priorMergeTarget == null
&& string.IsNullOrEmpty(target.prefix)
&& string.IsNullOrEmpty(target.suffix))
{
target.InferPrefixSuffix();
}
}
}
}
}