using UnityEngine; using UnityEngine.UI; using UnityEngine.Events; using System; using System.Collections; using System.Collections.Generic; namespace Fungus { public class MenuDialog : MonoBehaviour { // Currently active Menu Dialog used to display Menu options public static MenuDialog activeMenuDialog; protected Button[] cachedButtons; protected Slider cachedSlider; public static MenuDialog GetMenuDialog() { if (activeMenuDialog == null) { // Use first Menu Dialog found in the scene (if any) MenuDialog md = GameObject.FindObjectOfType(); if (md != null) { activeMenuDialog = md; } if (activeMenuDialog == null) { // Auto spawn a menu dialog object from the prefab GameObject prefab = Resources.Load("MenuDialog"); if (prefab != null) { GameObject go = Instantiate(prefab) as GameObject; go.SetActive(false); go.name = "MenuDialog"; activeMenuDialog = go.GetComponent(); } } } return activeMenuDialog; } public virtual void Awake() { Button[] optionButtons = GetComponentsInChildren