Question by
arcueidnorsborg · Jan 23, 2020 at 02:48 PM ·
audioaudiosourceaudioplay
Play sound when move by using script
I want to use a script to make the object play a sound effect when it moves, and stop the sound when it not moves. I searched for similar questions, but the methods provided by those questions are outdated.
Anyone can help me with this? The script should be similar to if(rigidbody.velocity.magnitude >= 0.1 && !audio.isPlaying()) { audio.clip = yourclip; audio.Play(); } But i really don't know how to write :(
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612222010im_/https://answers.unity.com/themes/thub/images/avi.jpg)