Using Unityengine;
Using System.Collections;
Using Unityengine.ui;
Using Unityengine.audio;
#if Unity_editor
Using Unityeditor;
#endif
public class Pausemanager:monobehaviour {
Public Audiomixersnapshot paused;
Public Audiomixersnapshot unpaused;
Canvas canvas;
void Start ()
{
Canvas = getcomponent<canvas> ();
}
void Update ()
{
if (Input.getkeydown (Keycode.escape))
{
canvas.enabled =!canvas.enabled;
Pause ();
}
}
public void Pause ()
{
Time.timescale = Time.timescale = = 0? 1:0;
Lowpass ();
}
void Lowpass ()
{
if (Time.timescale = = 0)
{
Paused. Transitionto (. 01f);
}
Else
{
Unpaused. Transitionto (. 01f);
}
}
public void Quit ()
{
#if Unity_editor
Editorapplication.isplaying = false;
#else
Application.Quit ();
#endif
}
}
————————————————————————————————————————————————
Using Unityengine;
Using System.Collections;
Using Unityengine.audio;
public class Mixlevels:monobehaviour {
Public Audiomixer mastermixer;
public void Setsfxlvl (float sfxlvl)
{
Mastermixer.setfloat ("Sfxvol", SFXLVL);
}
public void Setmusiclvl (float musiclvl)
{
Mastermixer.setfloat ("Musicvol", MUSICLVL);
}
}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Game pause interface and volume switch background music sound adjustment