You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

25 lines
453 B

using UnityEngine;
using UnityEngine.EventSystems;
public class SelectOnInput : MonoBehaviour {
public EventSystem eventSystem;
public GameObject selectedObject;
private bool buttonSelected = false;
void Start() {
}
void Update() {
if (Input.GetAxisRaw("Vertical") != 0 && !buttonSelected) {
eventSystem.SetSelectedGameObject(selectedObject);
buttonSelected = true;
}
}
private void OnDisable() {
buttonSelected = false;
}
}