C# Class GreatArcStudios.PauseManager

The pause menu manager. You can extend this to make your own. Everything is pretty modular, so creating you own based off of this should be easy. Thanks for downloading and good luck!
Inheritance: UnityEngine.MonoBehaviour
Show file Open project: GreatArcStudios/unitypausemenu Class Usage Examples

Public Properties

Property Type Description
AaCombo Dropdown
AfCombo Dropdown
AoBool System.Boolean
AoScriptName String
AoToggle Toggle
AudioEffectsSlider Slider
AudioMasterSlider Slider
AudioMusicSlider Slider
AudioPanel UnityEngine.GameObject
AudioPanelAnimator UnityEngine.Animator
CreditsPanel UnityEngine.GameObject
CreditsPanelAnimator UnityEngine.Animator
DefualtSelectedAudio UnityEngine.GameObject
DefualtSelectedCredits UnityEngine.GameObject
DefualtSelectedMain UnityEngine.GameObject
DefualtSelectedVideo UnityEngine.GameObject
DetailDensity float
DofBool System.Boolean
DofScriptName String
DofToggle Toggle
Effects UnityEngine.AudioSource[]
FovSlider Slider
FullscreenToggle Toggle
HardCodeSomeVideoSettings System.Boolean
HighQualTreeSlider Slider
LodBias float[]
MainCam UnityEngine.Camera
MainCamObj UnityEngine.GameObject
MainMenu String
MainPanel UnityEngine.GameObject
Mask UnityEngine.GameObject
MasterTexSlider Slider
ModelQualSlider Slider
Music UnityEngine.AudioSource[]
OtherUiElements UnityEngine.GameObject[]
PauseMenu UnityEngine.UI.Text
PresetLabel UnityEngine.UI.Text
QuitPanelAnimator UnityEngine.Animator
ReadSimpleTerrain UnityEngine.Terrain
ReadTerrain UnityEngine.Terrain
ReadUseSimpleTerrain System.Boolean
RenderDistSlider Slider
ResolutionLabel UnityEngine.UI.Text
ShadowCascadesSlider Slider
ShadowDist float[]
ShadowDistSlider Slider
SimpleTerrain UnityEngine.Terrain
Terrain UnityEngine.Terrain
TerrainDensitySlider Slider
TerrainQualSlider Slider
TimeScale float
TitleTexts UnityEngine.GameObject
UiEventSystem UnityEngine.EventSystems.EventSystem
UseSimpleTerrain System.Boolean
VSyncToggle Toggle
VidPanel UnityEngine.GameObject
VidPanelAnimator UnityEngine.Animator

Private Properties

Property Type Description
ApplyAudioMain IEnumerator
ApplyVideo IEnumerator
CancelAudioMain IEnumerator
CancelVideoMain IEnumerator
ChangeRes void
CreditsReturnMain IEnumerator
FromPreset void

Public Methods

Method Description
Apply ( ) : void

Apply the video settings

ApplyAudio ( ) : void

The method for changing the applying new audio settings

Audio ( ) : void

Show the audio panel

AudioIn ( ) : void

Play the "audio panel in" animation.

CancelAudio ( ) : void

Cancel the audio setting changes

CancelVideo ( ) : void

Cancel the video setting changes

CreditsIn ( ) : void
CreditsReturn ( ) : void

Return to the main menu from the credits panel

EnableSimpleTerrain ( System.Boolean b ) : void
LastPreset ( ) : void

Set the quality level one level lower. This is done by getting the current quality level, then using QualitySettings.DecreaseLevel(); to decrease the level. The current level variable is set to the new quality setting, and the label is updated.

LastRes ( ) : void

Method for moving to the last resoution in the allRes array. WARNING: This is not finished/buggy.

NextPreset ( ) : void

Set the quality level one level higher. This is done by getting the current quality level, then using QualitySettings.IncreaseLevel(); to increase the level. The current level variable is set to the new quality setting, and the label is updated.

NextRes ( ) : void

Method for moving to the next resoution in the allRes array. WARNING: This is not finished/buggy.

QuitCancel ( ) : void

Cancels quittting by playing an animation.

QuitGame ( ) : void

Method to quit the game. Call methods such as auto saving before qutting here.

QuitOptions ( ) : void

All the methods relating to qutting should be called here.

Restart ( ) : void

Restart the level by loading the loaded level.

Resume ( ) : void

Method to resume the game, so disable the pause menu and re-enable all other ui elements

ReturnToMenu ( ) : void

Loads the main menu scene.

SetFullScreen ( bool b ) : void

Set the game to windowed or full screen. This is meant to be used with a checkbox

SetGraphicsPreset ( int preset ) : void

Sets the Graphic to a Preset (from very low to extreme) (note: UI buttons in the inspector can carry a parameter, so you wont need 7 methods)

SetLodBias ( float loDBias ) : void

Change the lod bias using QualitySettings.lodBias = LoDBias / 2.15f; LoDBias is only divided by 2.15 because the max is set to 10 on the slider, and dividing by 2.15 results in 4.65, our desired max. However, deleting or changing 2.15 is compeletly fine.

SetMsaaLevel ( int level ) : void

Sets the MSAA to a specific level (between 0 and 4)

Start ( ) : void

The start method; you will need to place all of your inital value getting/setting here.

ToggleAo ( bool b ) : void

Toggle on or off Ambient Occulusion. This is meant to be used with a checkbox.

ToggleDof ( bool b ) : void

Toggle on or off Depth of Field. This is meant to be used with a checkbox.

TreeMaxLod ( float qual ) : void

Change the max amount of high quality trees using terrain.treeMaximumFullLODCount = (int)qual;

TurnOnVSync ( bool b ) : void
Update ( ) : void

The update method. This mainly searches for the user pressing the escape key.

UpdateAniso ( int anisoSetting ) : void

The method for changing aniso settings

UpdateCascades ( float cascades ) : void

The method for setting the amount of shadow cascades

UpdateDensity ( float density ) : void

Update terrain density

UpdateEffectsVol ( float f ) : void

Update the audio effects volume

UpdateFov ( float fov ) : void

Change the fov using a float. The defualt should be 60.

UpdateMasterVol ( float f ) : void

Audio Option Methods

UpdateMusicVol ( float f ) : void

Update music effects volume

UpdateRenderDist ( float f ) : void

Update the render distance using mainCam.farClipPlane = f;

UpdateShadowDistance ( float dist ) : void

Update the shadow distance using QualitySettings.shadowDistance = dist;

UpdateTerrainLod ( float qual ) : void

Change the height map max LOD using terrain.heightmapMaximumLOD = (int)qual;

UpdateTex ( float qual ) : void

Update the texture quality using QualitySettings.masterTextureLimit

UpdateTreeMeshAmt ( int f ) : void

Update full high quality tree mesh amount.

Video ( ) : void

Show video

VideoIn ( ) : void

Play the "video panel in" animation

Private Methods

Method Description
ApplyAudioMain ( ) : IEnumerator

Use an IEnumerator to first play the animation and then change the audio settings

ApplyVideo ( ) : IEnumerator

Use an IEnumerator to first play the animation and then change the video settings.

CancelAudioMain ( ) : IEnumerator

Use an IEnumerator to first play the animation and then change the audio settings

CancelVideoMain ( ) : IEnumerator

Use an IEnumerator to first play the animation and then changethe video settings

ChangeRes ( int index ) : void
CreditsReturnMain ( ) : IEnumerator

Use an IEnumerator to first play the animation and then hide other panels settings

FromPreset ( ) : void

Method Details

Apply() public method

Apply the video settings
public Apply ( ) : void
return void

ApplyAudio() public method

The method for changing the applying new audio settings
public ApplyAudio ( ) : void
return void

Audio() public method

Show the audio panel
public Audio ( ) : void
return void

AudioIn() public method

Play the "audio panel in" animation.
public AudioIn ( ) : void
return void

CancelAudio() public method

Cancel the audio setting changes
public CancelAudio ( ) : void
return void

CancelVideo() public method

Cancel the video setting changes
public CancelVideo ( ) : void
return void

CreditsIn() public method

public CreditsIn ( ) : void
return void

CreditsReturn() public method

Return to the main menu from the credits panel
public CreditsReturn ( ) : void
return void

EnableSimpleTerrain() public method

public EnableSimpleTerrain ( System.Boolean b ) : void
b System.Boolean
return void

LastPreset() public method

Set the quality level one level lower. This is done by getting the current quality level, then using QualitySettings.DecreaseLevel(); to decrease the level. The current level variable is set to the new quality setting, and the label is updated.
public LastPreset ( ) : void
return void

LastRes() public method

Method for moving to the last resoution in the allRes array. WARNING: This is not finished/buggy.
public LastRes ( ) : void
return void

NextPreset() public method

Set the quality level one level higher. This is done by getting the current quality level, then using QualitySettings.IncreaseLevel(); to increase the level. The current level variable is set to the new quality setting, and the label is updated.
public NextPreset ( ) : void
return void

NextRes() public method

Method for moving to the next resoution in the allRes array. WARNING: This is not finished/buggy.
public NextRes ( ) : void
return void

QuitCancel() public method

Cancels quittting by playing an animation.
public QuitCancel ( ) : void
return void

QuitGame() public method

Method to quit the game. Call methods such as auto saving before qutting here.
public QuitGame ( ) : void
return void

QuitOptions() public method

All the methods relating to qutting should be called here.
public QuitOptions ( ) : void
return void

Restart() public method

Restart the level by loading the loaded level.
public Restart ( ) : void
return void

Resume() public method

Method to resume the game, so disable the pause menu and re-enable all other ui elements
public Resume ( ) : void
return void

ReturnToMenu() public method

Loads the main menu scene.
public ReturnToMenu ( ) : void
return void

SetFullScreen() public method

Set the game to windowed or full screen. This is meant to be used with a checkbox
public SetFullScreen ( bool b ) : void
b bool
return void

SetGraphicsPreset() public method

Sets the Graphic to a Preset (from very low to extreme) (note: UI buttons in the inspector can carry a parameter, so you wont need 7 methods)
public SetGraphicsPreset ( int preset ) : void
preset int
return void

SetLodBias() public method

Change the lod bias using QualitySettings.lodBias = LoDBias / 2.15f; LoDBias is only divided by 2.15 because the max is set to 10 on the slider, and dividing by 2.15 results in 4.65, our desired max. However, deleting or changing 2.15 is compeletly fine.
public SetLodBias ( float loDBias ) : void
loDBias float
return void

SetMsaaLevel() public method

Sets the MSAA to a specific level (between 0 and 4)
public SetMsaaLevel ( int level ) : void
level int log2 of the desired level. /// 0 -> 0x MSAA (disabled). /// 1 -> 2x MSAA. /// 2 -> 4x MSAA. /// 3 -> 8x MSAA. ///
return void

Start() public method

The start method; you will need to place all of your inital value getting/setting here.
public Start ( ) : void
return void

ToggleAo() public method

Toggle on or off Ambient Occulusion. This is meant to be used with a checkbox.
public ToggleAo ( bool b ) : void
b bool
return void

ToggleDof() public method

Toggle on or off Depth of Field. This is meant to be used with a checkbox.
public ToggleDof ( bool b ) : void
b bool
return void

TreeMaxLod() public method

Change the max amount of high quality trees using terrain.treeMaximumFullLODCount = (int)qual;
public TreeMaxLod ( float qual ) : void
qual float
return void

TurnOnVSync() public method

public TurnOnVSync ( bool b ) : void
b bool
return void

Update() public method

The update method. This mainly searches for the user pressing the escape key.
public Update ( ) : void
return void

UpdateAniso() public method

The method for changing aniso settings
public UpdateAniso ( int anisoSetting ) : void
anisoSetting int
return void

UpdateCascades() public method

The method for setting the amount of shadow cascades
public UpdateCascades ( float cascades ) : void
cascades float
return void

UpdateDensity() public method

Update terrain density
public UpdateDensity ( float density ) : void
density float
return void

UpdateEffectsVol() public method

Update the audio effects volume
public UpdateEffectsVol ( float f ) : void
f float
return void

UpdateFov() public method

Change the fov using a float. The defualt should be 60.
public UpdateFov ( float fov ) : void
fov float
return void

UpdateMasterVol() public method

Audio Option Methods
public UpdateMasterVol ( float f ) : void
f float
return void

UpdateMusicVol() public method

Update music effects volume
public UpdateMusicVol ( float f ) : void
f float
return void

UpdateRenderDist() public method

Update the render distance using mainCam.farClipPlane = f;
public UpdateRenderDist ( float f ) : void
f float
return void

UpdateShadowDistance() public method

Update the shadow distance using QualitySettings.shadowDistance = dist;
public UpdateShadowDistance ( float dist ) : void
dist float
return void

UpdateTerrainLod() public method

Change the height map max LOD using terrain.heightmapMaximumLOD = (int)qual;
public UpdateTerrainLod ( float qual ) : void
qual float
return void

UpdateTex() public method

Update the texture quality using QualitySettings.masterTextureLimit
public UpdateTex ( float qual ) : void
qual float
return void

UpdateTreeMeshAmt() public method

Update full high quality tree mesh amount.
public UpdateTreeMeshAmt ( int f ) : void
f int
return void

Video() public method

Show video
public Video ( ) : void
return void

VideoIn() public method

Play the "video panel in" animation
public VideoIn ( ) : void
return void

Property Details

AaCombo public property

AA drop down menu.
public Dropdown AaCombo
return Dropdown

AfCombo public property

Aniso drop down menu.
public Dropdown AfCombo
return Dropdown

AoBool public static property

public static Boolean,System AoBool
return System.Boolean

AoScriptName public property

The Ambient Occlusion script name, ie: "AmbientOcclusion". You can leave this blank in the editor, but will throw a null refrence exception, which is harmless.
public String AoScriptName
return String

AoToggle public property

public Toggle AoToggle
return Toggle

AudioEffectsSlider public property

public Slider AudioEffectsSlider
return Slider

AudioMasterSlider public property

public Slider AudioMasterSlider
return Slider

AudioMusicSlider public property

public Slider AudioMusicSlider
return Slider

AudioPanel public property

This is the audio panel holder, which holds all of the silders for the audio panel and should be called "audio panel"
public GameObject,UnityEngine AudioPanel
return UnityEngine.GameObject

AudioPanelAnimator public property

Audio Panel animator
public Animator,UnityEngine AudioPanelAnimator
return UnityEngine.Animator

CreditsPanel public property

This is the credits panel holder, which holds all of the silders for the audio panel and should be called "credits panel"
public GameObject,UnityEngine CreditsPanel
return UnityEngine.GameObject

CreditsPanelAnimator public property

Credits Panel animator
public Animator,UnityEngine CreditsPanelAnimator
return UnityEngine.Animator

DefualtSelectedAudio public property

Defualt selected on the video panel
public GameObject,UnityEngine DefualtSelectedAudio
return UnityEngine.GameObject

DefualtSelectedCredits public property

public GameObject,UnityEngine DefualtSelectedCredits
return UnityEngine.GameObject

DefualtSelectedMain public property

Defualt selected on the video panel
public GameObject,UnityEngine DefualtSelectedMain
return UnityEngine.GameObject

DefualtSelectedVideo public property

Defualt selected on the video panel
public GameObject,UnityEngine DefualtSelectedVideo
return UnityEngine.GameObject

DetailDensity public property

The terrain detail density float. It's only public because you may want to adjust it in editor
public float DetailDensity
return float

DofBool public static property

public static Boolean,System DofBool
return System.Boolean

DofScriptName public property

The Depth of Field script name, ie: "DepthOfField". You can leave this blank in the editor, but will throw a null refrence exception, which is harmless.
public String DofScriptName
return String

DofToggle public property

public Toggle DofToggle
return Toggle

Effects public property

An array of sound effect audio sources
public AudioSource[],UnityEngine Effects
return UnityEngine.AudioSource[]

FovSlider public property

public Slider FovSlider
return Slider

FullscreenToggle public property

public Toggle FullscreenToggle
return Toggle

HardCodeSomeVideoSettings public property

Editor boolean for hardcoding certain video settings. It will allow you to use the values defined in LOD Bias and Shadow Distance
public Boolean,System HardCodeSomeVideoSettings
return System.Boolean

HighQualTreeSlider public property

public Slider HighQualTreeSlider
return Slider

LodBias public property

Lod bias float array. You should manually assign these based on the quality level.
public float[] LodBias
return float[]

MainCam public property

The main camera, assign this through the editor.
public Camera,UnityEngine MainCam
return UnityEngine.Camera

MainCamObj public property

The main camera game object, assign this through the editor.
public GameObject,UnityEngine MainCamObj
return UnityEngine.GameObject

MainMenu public property

Main menu level string used for loading the main menu. This means you'll need to type in the editor text box, the name of the main menu level, ie: "mainmenu";
public String MainMenu
return String

MainPanel public property

This is the main panel holder, which holds the main panel and should be called "main panel"
public GameObject,UnityEngine MainPanel
return UnityEngine.GameObject

Mask public property

The mask that makes the scene darker
public GameObject,UnityEngine Mask
return UnityEngine.GameObject

MasterTexSlider public property

public Slider MasterTexSlider
return Slider

ModelQualSlider public property

public Slider ModelQualSlider
return Slider

Music public property

An array of music audio sources
public AudioSource[],UnityEngine Music
return UnityEngine.AudioSource[]

OtherUiElements public property

An array of the other UI elements, which is used for disabling the other elements when the game is paused.
public GameObject[],UnityEngine OtherUiElements
return UnityEngine.GameObject[]

PauseMenu public property

Pause menu text
public Text,UnityEngine.UI PauseMenu
return UnityEngine.UI.Text

PresetLabel public property

The preset text label.
public Text,UnityEngine.UI PresetLabel
return UnityEngine.UI.Text

QuitPanelAnimator public property

Quit Panel animator
public Animator,UnityEngine QuitPanelAnimator
return UnityEngine.Animator

ReadSimpleTerrain public static property

public static Terrain,UnityEngine ReadSimpleTerrain
return UnityEngine.Terrain

ReadTerrain public static property

public static Terrain,UnityEngine ReadTerrain
return UnityEngine.Terrain

ReadUseSimpleTerrain public static property

public static Boolean,System ReadUseSimpleTerrain
return System.Boolean

RenderDistSlider public property

public Slider RenderDistSlider
return Slider

ResolutionLabel public property

Resolution text label.
public Text,UnityEngine.UI ResolutionLabel
return UnityEngine.UI.Text

ShadowCascadesSlider public property

public Slider ShadowCascadesSlider
return Slider

ShadowDist public property

Shadow distance array. You should manually assign these based on the quality level.
public float[] ShadowDist
return float[]

ShadowDistSlider public property

public Slider ShadowDistSlider
return Slider

SimpleTerrain public property

Other terrain variable used if you want to have an option to target low end harware.
public Terrain,UnityEngine SimpleTerrain
return UnityEngine.Terrain

Terrain public property

One terrain variable used if you have a terrain plugin like rtp.
public Terrain,UnityEngine Terrain
return UnityEngine.Terrain

TerrainDensitySlider public property

public Slider TerrainDensitySlider
return Slider

TerrainQualSlider public property

public Slider TerrainQualSlider
return Slider

TimeScale public property

Timescale value. The defualt is 1 for most games. You may want to change it if you are pausing the game in a slow motion situation
public float TimeScale
return float

TitleTexts public property

These are the game objects with the title texts like "Pause menu" and "Game Title"
public GameObject,UnityEngine TitleTexts
return UnityEngine.GameObject

UiEventSystem public property

Event system
public EventSystem,UnityEngine.EventSystems UiEventSystem
return UnityEngine.EventSystems.EventSystem

UseSimpleTerrain public property

Boolean for turning on simple terrain
public Boolean,System UseSimpleTerrain
return System.Boolean

VSyncToggle public property

public Toggle VSyncToggle
return Toggle

VidPanel public property

This is the video panel holder, which holds all of the controls for the video panel and should be called "vid panel"
public GameObject,UnityEngine VidPanel
return UnityEngine.GameObject

VidPanelAnimator public property

Video Panel animator
public Animator,UnityEngine VidPanelAnimator
return UnityEngine.Animator