Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class ButtonPanel: MonoBehaviour {
- static List<Button> buttons = new List<Button>();
- void Awake() {
- buttons.AddRange(GetComponentsInChildren<Button>());
- foreach (var button in buttons) {
- button.gameObject.SetActive(false);
- }
- }
- public static void EnableButton(int index) {
- if (index < 0 || index >= buttons.Count) return;
- buttons[index].gameObject.SetActive(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement