- Home /
Get AudioClips into array without Resources.LoadAll()
I have a bunch of mp3's imported as AudioClips, if I say
public List<AudioClip> jams;
I can drag-and-drop them one-by-one and then do whatever I want with them in the script. Obviously with alot of files this is time-consuming and tedious. Is there a way I can fill up the array in code, even with Editor-only functionality? I really only need to do it once, then I can copy-and-paste the filled-out component.
Almost all searches on AudioClip arrays reference Resources.LoadAll() -- I understand about the Resources folder, including Unity's own recommendation to not use it (https://unity3d.com/learn/tutorials/topics/best-practices/resources-folder)
For that reason, I'd like to go another way. Any way to get this done? TIA
Answer by Hellium · Feb 19, 2018 at 10:27 AM
Another possibility is the following!
Select the gameobject holding the script with the array of audio clips.
Lock the inspector using the little icon at the top right of the inspector
Select all your audio clips from the
Projecttab. You can filter the tab using the search bar for example. Or you can use CTRL + click to add an audio clip to your current selectionHold the left button of your mouse, & drop the selection to the array in the inspector
Your answer
Follow this Question
Related Questions
Loading MP3's into an Audio Array and assigning them to members of a GameObject Array 1 Answer
About Array to AudioClip 0 Answers
Need help to play a random explosion sound from an array. 1 Answer
Any ways to optimize an audio clip in code ? 0 Answers
How to generate waveform from AudioClip? 2 Answers