Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

stop audio unity

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();
            }
        }
        
        }
Comment

stop sound in unity

audioSource.Play();//Start playing
audioSource.Stop();//Stop playing
Comment

PREVIOUS NEXT
Code Example
Csharp :: how to get desktop name in c# 
Csharp :: unity2d click on gameobject 
Csharp :: check if current time is in the morning c# 
Csharp :: how to get the ip asp.net mvc 
Csharp :: c# dictionary get highest key 
Csharp :: unity agent does not move 
Csharp :: c# byte array to string 
Csharp :: detect keypress c# 
Csharp :: how to unescape  in a string java 
Csharp :: add admin priviledge to c# program 
Csharp :: unity put children in list 
Csharp :: making a list of chars in c# 
Csharp :: move object to mouse unity 
Csharp :: emboss button in android app 
Csharp :: how to check if string can be converted to int c# 
Csharp :: c# paste from clipboard 
Csharp :: how to check the distance between two dates c# 
Csharp :: rigidbody.addtorque 
Csharp :: unity detect any key 
Csharp :: asp net bootstrap 5 navigation bar 
Csharp :: get waht is differnt between two arrays c# 
Csharp :: reverse for loop 
Csharp :: select a object from list based on a value csharp 
Csharp :: c# append multiline textbox 
Csharp :: make invisible unity 
Csharp :: c# afficher texte 
Csharp :: c# shuffle list 
Csharp :: how to copy last element in list c# 
Csharp :: c# get offset from timezone 
Csharp :: convert iformfile to byte array c# 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =