Managing game settings and audio

Create an Empty GameObject and name it uiController. We now need to create a UI Controller script that will handle the user interaction. Create a new C# script and name it UiController.cs.

Note: The scripts in this chapter will be updated and modified as we progress.

A listing of the UI controller is as follows:

using UnityEngine; using UnityEngine.UI; namespace com.noorcon.rpg2e { public class UiController : MonoBehaviour { public RectTransform OptionsPanel; public Slider ControlMainVolume; public Slider ControlFXVolume; public void Update() { } public void DisplaySettings() { GameMaster.instance.DisplaySettings = !GameMaster.instance.DisplaySettings; OptionsPanel.gameObject.SetActive(GameMaster.instance.DisplaySettings); ...

Get Building an RPG with Unity 2018 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.