GoodNoodle

Beastiery Controler

Jan 19th, 2024
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.EventSystems;
  5. using UnityEngine.UI;
  6.  
  7. public class BeastieryController : MonoBehaviour
  8. {
  9.     [SerializeField] Button[] thebuttons;
  10.  
  11.    
  12.  
  13.     // Start is called before the first frame update
  14.     void Start()
  15.     {
  16.         ButtonInit();
  17.     }
  18.  
  19.     void ButtonInit()
  20.     {
  21.         Enter();      
  22.     }
  23.  
  24.     // Update is called once per frame
  25.     void Update()
  26.     {
  27.        
  28.     }
  29.  
  30.     public void Enter(int currentButton = 0)
  31.     {
  32.      EventSystem.current.SetSelectedGameObject(thebuttons[currentButton].gameObject);
  33.     }
  34. }
  35.  
Add Comment
Please, Sign In to add comment