hellbound/Assets/Scripts/Managers/Sounds/SoundPack.cs

31 lines
757 B
C#
Raw Permalink Normal View History

2021-11-26 11:16:25 +03:00
using UnityEngine;
[CreateAssetMenu(menuName = "Sound/Pack", fileName = "Sound Pack")]
public class SoundPack : ScriptableObject
{
public SoundClip[] Clips;
#if UNITY_EDITOR
[CustomButton("Fill all by clip")]
public void Fill()
{
for (var i = 0; i < Clips.Length; i++)
{
if(Clips[i] == null)
continue;
string clipName = Clips[i].clip == null
? "null"
: Clips[i].clip.name;
Clips[i].name = clipName;
Clips[i].pitch = 1f;
Clips[i].volume = 1f;
}
UnityEditor.EditorUtility.SetDirty(this);
UnityEditor.AssetDatabase.SaveAssets();
UnityEditor.AssetDatabase.Refresh();
}
#endif
}