Skip to content

Instantly share code, notes, and snippets.

@sonoichi60
Created July 31, 2018 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sonoichi60/a730287eb320523b95919fce6cedc922 to your computer and use it in GitHub Desktop.
Save sonoichi60/a730287eb320523b95919fce6cedc922 to your computer and use it in GitHub Desktop.
ClipのInspecter表示を変更するサンプル
using UnityEditor;
[CustomEditor(typeof(TestClip))]
public class TestClipInspector : Editor {
private SerializedProperty paramTypeProp ;
private void OnEnable()
{
paramTypeProp = serializedObject.FindProperty("ParamType");
}
public override void OnInspectorGUI()
{
EditorGUILayout.PropertyField(paramTypeProp);
var index = paramTypeProp.enumValueIndex;
var type = (EParamType)index;
switch (type)
{
case EParamType.Int:
EditorGUILayout.PropertyField(serializedObject.FindProperty("IntParam"));
break;
case EParamType.Float:
EditorGUILayout.PropertyField(serializedObject.FindProperty("FloatParam"));
break;
case EParamType.String:
EditorGUILayout.PropertyField(serializedObject.FindProperty("StrParam"));
break;
}
serializedObject.ApplyModifiedProperties();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment