- Home /
Does creating several "audio players" load several AudioClips in the memory?
Hello everybody. In my game I have a GameObject which has a BoxCollider2D, an AudioSource and 2 public AudioClips references, which I drag and drop in the inspector. That's my Audio Player object, which I use to play the sound of doors opening and closing, inside an OnTriggerEnter2D method. I want to have a few of these, because I have like 10 doors in the game. My question is: does creating 10 of these audio players mean that 20 audio clips are loaded in the memory, or unity calls the audioclip only to play it and then frees the memory? If Unity doesn't free the memory, would it be better if I used Resources.Load to load the AudioClips? Or maybe if I used a single object with a listener method that fires the sound when the player hits one of the triggers? What's do you guys recommend? Sorry for my poor English.
Answer by FlaSh-G · Nov 01, 2017 at 10:40 AM
No worries, you're fine. Assets are loaded once and then reused by as many objects as you like.
Your answer
Follow this Question
Related Questions
How can I improve OGG music quality? 1 Answer
Array of AudioClips not playing, please help 3 Answers
Loading Resources in a Native Plugin 0 Answers