Answer the question
In order to leave comments, you need to log in
How to stop background sound in Unity separately from the rest on the same object?
A script hangs on the object, it is necessary that when clicked, a sound is played, background music (loop) plays, and when a collision occurs, the background music stops and the sound of the collision plays. Sound on click and collision made through PlayOneShot (). How to add and stop background music? That is, if I throw background music on the object's audio source and turn off this audio source on collision, then the background music stops playing along with the rest of the sounds. How can you separate them?
Answer the question
In order to leave comments, you need to log in
And you for the "other sounds" use a separate AudioSource, then you can turn them off independently of each other. And look towards Audio Mixer , maybe you don't have to write bicycles.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question