Audio Issue

Just wandered if there is another way of disabling booster sound other than cutting off every sound attached to the object in both scripts?
My issue is that if I wont use GetComponent().enabled = false; upon success in CollisionHandler.cs than there is a conflict between both scripts. Movement.cs “else audioSource.Stop();” is cutting any other sound unless Movement is disabled.
Is there a way to disable PlayOneShot(mainEngine) only?

Hi Mateusz,

PlayOneShot is called on a specific object. Of course, you could disable that specific object. Maybe you’ll need more AudioSource components if you want to keep playing other sounds.

Please feel free to modify Rick’s solution. If you come up with different ideas than his, his solution might not work well for you. That should not be a problem, though, because you already have the knowledge you need: AudioSource component, referencing, calling methods, if-statements, disabling/enabling components.

Hi. Thanks for the reply.
Fount the solution.
Instead of using
else audioSource.Stop() methode
Ive used
if (Input.GetKeyUp(KeyCode.Space))
{
audioSource.Stop();
}
It works like a charm Thank You for suggestion.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms