Skip to main content
2 of 2
added 934 characters in body
Bogdan
  • 163
  • 6

Put this script into the folder named Editor and you will get list with audioClips in your inspector. Set slider to count of elements and empty slots appear.

using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;


[CustomEditor(typeof(AudioSource))]
public class AudioSourceEditor : Editor
{
    public List<AudioClip> audioClips;

    [Obsolete]
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        EditorGUILayout.LabelField("Audio Clips:");
        EditorGUILayout.BeginHorizontal();
        {
            int count = EditorGUILayout.IntSlider("Count", audioClips.Count, 0, 10);
            if (count != audioClips.Count)
            {
                audioClips.Clear();
                for (int i = 0; i < count; i++)
                {
                    audioClips.Add(null);
                }
            }
        }
        EditorGUILayout.EndHorizontal();
        foreach (AudioClip audioClip in audioClips)
        {
            EditorGUILayout.ObjectField(audioClip, typeof(AudioClip));
        }
    }
}



enter image description here

Bogdan
  • 163
  • 6