Created
July 31, 2018 15:58
-
-
Save sonoichi60/a730287eb320523b95919fce6cedc922 to your computer and use it in GitHub Desktop.
ClipのInspecter表示を変更するサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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