Passion & UI

This commit is contained in:
SoulliesOfficial
2026-06-12 17:11:39 -04:00
parent 7bc1e1722c
commit 6d7ebc5825
3444 changed files with 865284 additions and 463132 deletions

View File

@@ -0,0 +1,46 @@
using UnityEngine;
using UnityEngine.UI;
namespace Michsky.UI.Shift
{
public class ScrollGamepadManager : MonoBehaviour
{
[Header("Settings")]
public float changeValue = 0.05f;
Scrollbar scrollbarObject;
[Header("Input")]
public string inputAxis = "Xbox Right Stick Vertical";
public bool invertAxis = false;
void Start()
{
try { scrollbarObject = gameObject.GetComponent<Scrollbar>(); }
catch { Debug.LogWarning("Scrollbar is missing. Scrolling via gamepad won't work."); }
}
void Update()
{
if (scrollbarObject != null)
{
float h = Input.GetAxis(inputAxis);
if (invertAxis == false)
{
if (h == 1)
scrollbarObject.value -= changeValue;
else if (h == -1)
scrollbarObject.value += changeValue;
}
else
{
if (h == 1)
scrollbarObject.value += changeValue;
else if (h == -1)
scrollbarObject.value -= changeValue;
}
}
}
}
}