- Home /
Detecting audio file attached to audio source at runtime.
Hi,
My audio sources are created and managed dynamically at runtime, I need to be able to detect the name of the audio file which is attached to the audio source at any time.
I know you can detect the name of the audiosource gameobject using :
if (gameobject.name.Contains("xxxxxx"))
but I need to be able to detect the name of the actual file attached the the audio source
Any help would be appreciated.
Thanks
Answer by steakpinball · Oct 23, 2015 at 06:10 PM
You can use the clip
property of an audio source to get info from the file.
if (audiosource.clip.name.Contains("xxxxx"))
There are more properties on the clip you can access as well.
Your answer
Follow this Question
Related Questions
detect audio then record and then play 0 Answers
How to start a sound not from it's start ? 2 Answers
How to change audio parameters with script? 0 Answers
How to get consecutive voice clips to sound natural 1 Answer
Audio clip not playing 1 Answer