how do get a desired audio clip to play if these conditions are met? I already have a working footsteps sound effect and tried to use the same getcomponent.play method but no sound plays when the spacebar is pressed
Here is my code (i know there is a better way to double jump but i figured this out alone and it works for me)
if (controller.isGrounded)
{
numberOfJumps = 0;
if (Input.GetButtonDown (“Jump”) && numberOfJumps <= 1)
{
numberOfJumps += 1;
moveDirection.y = jumpForce;
GetComponent().Play();
}
}
if(!controller.isGrounded )
{
if (Input.GetButtonDown(“Jump”) && numberOfJumps <= 1)
{
numberOfJumps += 1;
moveDirection.y = jumpForce;
GetComponent().Play();
}
}