Created by
Ivan
| using UnityEngine;
using UnityEditor;
using Sirenix.OdinInspector.Editor;
using System;
using System.Collections.Generic;
[CustomPropertyDrawer(typeof(AudioClip)), DrawerPriority(0, 0, 1, 0)]
public class AudioClipPropertyDrawer : PropertyDrawer {
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label) {
return EditorGUI.GetPropertyHeight(prop);
}
public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label) {
EditorGUI.BeginProperty(position, label, prop);
if (prop.objectReferenceValue != null) {
float totalWidth = position.width;
position.width = totalWidth - (totalWidth / 4);
EditorGUI.PropertyField(position, prop, true);
position.x += position.width;
position.width = totalWidth / 4;
GUI.Button(position, "test");
} else {
EditorGUI.PropertyField(position, prop, true);
}
EditorGUI.EndProperty();
}
}
|
| using UnityEngine;
using System.Collections;
public class SoundTest : MonoBehaviour {
public AudioClip[] soundEffects;
}
|