Firstborn/Assets/RPG Creation Kit/Scripts/Input/Gamepad Support/Gamepad_PreventDeselection.cs
Schaken-Mods 959e80cf72 assets upload
assets upload description.
2023-03-28 12:16:30 -05:00

29 lines
704 B
C#

using RPGCreationKit.Player;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using RPGCreationKit;
public class Gamepad_PreventDeselection : MonoBehaviour
{
EventSystem evt;
GameObject sel;
private void Start()
{
evt = EventSystem.current;
}
private void Update()
{
if (RckInput.isUsingGamepad)
{
if (evt.currentSelectedGameObject != null && evt.currentSelectedGameObject != sel)
sel = evt.currentSelectedGameObject;
else if (sel != null && evt.currentSelectedGameObject == null)
evt.SetSelectedGameObject(sel);
}
}
}