- Home /
Does Unity share sound files?
Hi guys,
This is a newbie performance question.
I have 2 objects. They each have the same script applied which uses five different sound files in an AudioClip Array. I use the same five sound files in each script.
This will be important simply because I will end up with the thirty or more objects using this script each with the same five sound files.
Does Unity treat these as ten different sound files or does it recognise the sound files as being the same? As in, will it have to load/store the sound files multiple times.
I hope I explained this well enough.
Many thanks for your time!
Sincerely,
Bruce
Answer by code-blep · Dec 03, 2012 at 06:43 PM
Hi BruceT,
Unity will recognise that they are the same files because you refer to the same ones.
If it is critical then you could run some tests by building your project and looking at the file sizes generated.
Hope it helps.
Paul
Thanks Paul! I will try a build on the game as you suggest but you made me feel a lot better. What's a zombie game without LOTS of zombies?
Thanks again :)
lol! No problem. Heavy use of the Z Virus is ALWAYS recommend ;)
Your answer
![](https://koobas.hobune.stream/wayback/20220613084900im_/https://answers.unity.com/themes/thub/images/avi.jpg)