31 lines
757 B
C#
31 lines
757 B
C#
|
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
|
|||
|
}
|