SHARE
TWEET

Untitled

a guest Oct 14th, 2017 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6.  
  7. public class ButtonPanel: MonoBehaviour {
  8.  
  9.     static List<Button> buttons = new List<Button>();
  10.  
  11.     void Awake() {
  12.  
  13.         buttons.AddRange(GetComponentsInChildren<Button>());
  14.  
  15.         foreach (var button in buttons) {
  16.             button.gameObject.SetActive(false);
  17.         }
  18.  
  19.     }
  20.  
  21.     public static void EnableButton(int index) {
  22.  
  23.         if (index < 0 || index >= buttons.Count) return;
  24.  
  25.         buttons[index].gameObject.SetActive(true);
  26.  
  27.     }
  28.  
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top