Question : stop audio unity
Answered by : zarden
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public AudioSource MyAudioSource; //put your object in inspector that have the audio
void Update(){
if (Input.GetKeyDown(KeyCode.Escape)) //When press ESC to pause the game { if (Time.timeScale == 0) { MyAudioSource.Stop(); } else { MyAudioSource.Play(); } } }
Source : | Last Update : Sun, 03 Apr 22
Question : stop sound in unity
Answered by : successful-sandpiper-zknwjxkunfm5
audioSource.Play();//Start playing
audioSource.Stop();//Stop playing
Source : | Last Update : Tue, 01 Dec 20