Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class NewBehaviourScript : MonoBehaviour {
- public AudioClip jump_clip; // defining the audio clip being used
- void Start () {
- audio.clip = jump_clip;
- }
- // Update is called once per frame
- void Update () {
- if (Input.GetButtonDown("Jump"))
- {
- if(audio.isPlaying == true)
- {
- audio.Stop();
- }
- else
- {
- audio.Play();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment