Advertisement
talmud

GUI manager persistent prefs

Nov 13th, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class GUIManager : MonoBehaviour {
  6.  
  7. public GameObject MainMenu;
  8. public GameObject OptionsMenu;
  9. public GameObject Options;
  10. public GameObject Gameplay;
  11.  
  12. public AudioControl audioControl;
  13.  
  14. public void Start()
  15. {
  16. float existingMaster = PlayerPrefs.GetFloat(audioControl.MasterVolume, 1f);
  17. float existingMusic = PlayerPrefs.GetFloat(audioControl.MusicVolume, 1f);
  18. float existingSFX = PlayerPrefs.GetFloat(audioControl.SFXVolume, 1f);
  19.  
  20. audioControl.SetMasterLevel(existingMaster);
  21. audioControl.SetMusicLevel(existingMusic);
  22. audioControl.SetSfxLevel(existingSFX);
  23. }
  24.  
  25.  
  26. public void MainToOptions()
  27. {
  28. MainMenu.CrossFade(OptionsMenu);
  29. }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement