Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

pause 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

audio source pause unity


using UnityEngine;[RequireComponent(typeof(AudioSource))]
public audioSource audioSource  = GetComponent<AudioSource>();

void Start();{
	audioSource.Pause();
}

Comment

PREVIOUS NEXT
Code Example
Csharp :: c# print to console 
Csharp :: unity c# on trigger enter with specific gameobject 
Csharp :: regex for email c# 
Csharp :: c# loop through datatable 
Csharp :: Publishing A Single EXE File In.NET Core 
Csharp :: get string last character vb.net 
Csharp :: C# string format sepperate every thousand 
Csharp :: clear screen putty 
Csharp :: bash if null or empty 
Csharp :: create new gameobject unity 
Csharp :: c# resize image keep aspect ratio 
Csharp :: is letter c# 
Csharp :: how to convert angle to vector in c# 
Csharp :: how to input a double in c# 
Csharp :: c# long to int 
Csharp :: how to edit Camera.size property unity 
Csharp :: mouselook script unity 
Csharp :: how to make rb.addforce 2d 
Csharp :: Convert Newtonsoft.Json.Linq.JArray to type System.Collections.Generic 
Csharp :: month number to text in c# 
Csharp :: even number checker in c# 
Csharp :: string to list c# 
Csharp :: c# create datatable 
Csharp :: unity google play games plugin spam 
Csharp :: c# how to output in between 0 - 100 in an int array 
Csharp :: c# check if is float 
Csharp :: C# define a block as text 
Csharp :: c # c^b 
Csharp :: c# close 1 form open another form 
Csharp :: C# delete last enviroment new line 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =