Files
2026-03-03 05:27:03 +05:00

29 lines
688 B
C#

using System;
using UHFPS.Input;
using UnityEngine;
using UnityEngine.UI;
namespace UHFPS.Runtime
{
public class HotspotKey : MonoBehaviour
{
public InputReference UseKey;
public Image HotspotSprite;
private IDisposable disposable;
private void Awake()
{
if (!InputManager.HasReference)
return;
disposable = InputManager.GetBindingPath(UseKey.ActionName, UseKey.BindingIndex)
.GlyphSpriteObservable.Subscribe(icon => HotspotSprite.sprite = icon);
}
private void OnDestroy()
{
disposable.Dispose();
}
}
}