Verifying File Name for Programmer Instrument

Hi, I’m using FMOD Programmer Instrument for VO playback in our game.
The code to use this programmer sound was just mostly copied and pasted from the documentation
page below with minimal adjustment, because I don’t completely understand what each line does.
https://www.fmod.com/docs/2.00/unity/examples-programmer-sounds.html

Some lines are not dubbed in the game. Is there an efficient way of C# code to check whether the file name is a valid input with a corresponding audio file, before actually making the call to play it?

Hi,

You could call System.IO.File.Exists("audio\\file\\path") which will return true if the file exists.

Hope this helps!

1 Like

And if anyone else using Unity and needs the extra hint:
System.IO.File.Exists(Application.streamingAssetsPath + "fileName") might save you some time.

1 Like