LethalCompany/Lethal Company/ExportedProject/Assets/Scripts/Assembly-CSharp/SelectUIForGamepad.cs

30 lines
500 B
C#
Raw Normal View History

2023-12-22 22:51:17 +00:00
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class SelectUIForGamepad : MonoBehaviour
{
public bool doOnStart;
private void Start()
{
if (doOnStart && base.gameObject.activeSelf)
{
base.gameObject.GetComponent<Button>().Select();
}
}
private void OnEnable()
{
base.gameObject.GetComponent<Button>().Select();
}
private void OnDisable()
{
if (!(EventSystem.current == null))
{
EventSystem.current.SetSelectedGameObject(null);
}
}
}