How to play audio base on a variable, what am i missing here?

I’m trying to play an audio that loops base on a variable, please help

You are calling “audio.Play()” every frame. This is not what you meant to do.
Try to change the value of trigger inside your if statement so it is not called in the next frame.
In addition, you should set the volume of the audio source (_audio.volume = 1f or whatever).

I am still getting this errors. I have applied all the things you told me. I changed the trigger to “off” when it enters the if statement. However I’m still having this problem that maybe causing why it won’t play.


here’s for my c# soundeffect script