Is Audiosource.Play() locked?

Hello,
I’m currently creating a footstep system and am having a problem playing the sounds.

If I call the function to play the sounds regularly, the sounds from Audiosource.Play() are not output regularly.

The interval is approx. 0.5 - 1 second (Run and Walk)

If I set the interval to 2 seconds, for example, the audio source plays everything without any problems.

it feels like audiosource.play() has an internal lock.

A debug output is displayed on time but the audio source does not always play the sound.
sometimes not at all and sometimes twice in a row.

Thanks in advance.

What version do you use? In Flax 1.7 we’ve fixed lots of issues with Audio.

Hello, the problem is now solved at this moment :slight_smile:

i Use the Master Branch from today. ( 1.7.6404 )

The first problem was that streaming is on by default when importing.
This prevents the audio file from playing in real time.
And real time is necessary for footsteps.
A reimport without streaming solves the problem.

The second problem was when a sound was played, the same sound would not be played again.
Since the footsteps are played in a random order, an audio clip may be played twice in a row.

An Audiosource.Stop is required to rewind the clip.
now it works as it should.

A function like in Unity “audiosource.PlayOneShot” would be quite good.

1 Like