Search Unity

Playing footstep sound?

Discussion in 'Audio & Video' started by Sykoo, Jan 15, 2015.

Thread Status:
Not open for further replies.
  1. Sykoo

    Sykoo

    Joined:
    Jul 25, 2014
    Posts:
    1,394
    Hi there!

    So basically, my issue is that my audio is working when I walk as I use if(Input.GetKey...) statement, but then when the player is !Grounded (basically jumps), I make the audio stop. When player reaches ground again and was already moving in air, then the audio still stops. I can find logic in that because I check with GetKey and not GetKeyDown, but when I do GetKeyDown it practically keeps on playing itself until not actually playing as it's called each frame.

    Help me please, I cannot find any logic here :(
     
  2. Ibzy

    Ibzy

    Joined:
    Sep 15, 2013
    Posts:
    112
    Hi Sykoo,

    Is there a sound played as part of the jumping function? If so - I imagine this is cutting into the loop of the footstep sound. Also, does the sound continue if you quickly release and re-press "forward"?
     
  3. Sykoo

    Sykoo

    Joined:
    Jul 25, 2014
    Posts:
    1,394
    No it doesn't contain any jumping sound. And no it ain't continueing, it starts over.
     
  4. Ibzy

    Ibzy

    Joined:
    Sep 15, 2013
    Posts:
    112
    Sorry, start over is what I meant.

    Are you able to post the script that activates the sound?
     
  5. Sykoo

    Sykoo

    Joined:
    Jul 25, 2014
    Posts:
    1,394
    Code (CSharp):
    1. if(Input.GetKeyDown(KeyCode.D))
    2. {
    3. audio.Play();
    4. }
    thank you for your concern :)
     
  6. Ibzy

    Ibzy

    Joined:
    Sep 15, 2013
    Posts:
    112
    and this is in your update function? can we see your full update()?
     
  7. Sykoo

    Sykoo

    Joined:
    Jul 25, 2014
    Posts:
    1,394
    I'll post it soon. Yes, it is in my update function. Then I just check if the player is grounded or not. If not grounded, then audio stops no matter if player is walking. But when he reaches ground and gets grounded again then audio plays but it ain't working.
     
  8. alartina

    alartina

    Joined:
    Feb 27, 2020
    Posts:
    1
  9. amitshow

    amitshow

    Joined:
    Apr 3, 2020
    Posts:
    1
    if(Input.GetKeyDown(KeyCode.D))
    {
    audio.Play();
    }
    Now you can easily play audio and video and stream your favorite movies on your respective device using showbox app.
     
  10. kristendunt

    kristendunt

    Joined:
    Jul 9, 2020
    Posts:
    1
    Basically, my issue is that my audio works when I walk the way I use if it's a statement (Input.GetKey ...), but then when. the player! Grounded (basically jump), I stop the sound. When a player reaches the ground again and is already moving in the air, the sound still stops. I can get logic in that because vpn deals I study with GetKey and not with GetKeyDown, but when I do GetKeyDown it keeps me playing practically so that I don't play the so-called frame. coin master
     
  11. Tomshell

    Tomshell

    Joined:
    Jul 25, 2020
    Posts:
    1
    I would advise you all to try some Music Tips at Smarttip. It helped me and I hope this would help you as well.
     
  12. joemoxley95

    joemoxley95

    Joined:
    Aug 5, 2020
    Posts:
    1
    To get the latest MOD APK yoou can visit geekfell
     
  13. Alexroberto

    Alexroberto

    Joined:
    Jan 13, 2021
    Posts:
    1
    also, this is in your update work? would we be able to see your full update()?
     
  14. thomaskin12

    thomaskin12

    Joined:
    May 4, 2021
    Posts:
    1
    When a player reaches the ground again and is already moving in the air
     
  15. KalOBrien

    KalOBrien

    Administrator

    Joined:
    Apr 20, 2021
    Posts:
    89
    I'd recommend making a new thread as its off topic to this one.
     
  16. mathewperry

    mathewperry

    Joined:
    Jun 2, 2021
    Posts:
    1
    You need to call this capacity from the Update work, since the state gets reset each casing. It won't return valid until the client has delivered the key
     
  17. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,500
    Locking this thread, it's just a necro/spam magnet.
     
Thread Status:
Not open for further replies.