I’m relatively new to coding so if this seems like it’s a stupid question… it probably is.
I have two different scenes, the Game Play scene and the Main Menu scene. When the user clicks a player on the Main Menu scene a prefab of the selected player loads into the Game Play scene.
My problem is with the Sound Effects Button.
When the player jumps he makes a jumping sound. I want to make it so that when I press the Sound Button the Audio Source “Jump” inside the player gets muted, and when I press it again it gets unmuted.
The player can only jump when he is touching the floor.
if (Input.GetButtonDown("Jump") && isGrounded)
{
myBody.AddForce(new Vector2(0f, jumpForce), ForceMode2D.Impulse);
jump.Play();
}
Functions of Sound Effects On
Functions of Sound Effects Off
With these functions the Player 1 Audio Source and the Player 2 Audio Source don’t seem to be working properly.