29 lines
675 B
C#
29 lines
675 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Invector.vCharacterController.vActions
|
|
{
|
|
[RequireComponent(typeof(CanvasGroup))]
|
|
public class CanvasGroupInteractable : MonoBehaviour
|
|
{
|
|
public float interactable = 1f;
|
|
public float notInteractable = 0.45f;
|
|
|
|
public Button button;
|
|
private CanvasGroup canvasGroup;
|
|
|
|
private void Awake()
|
|
{
|
|
canvasGroup = GetComponent<CanvasGroup>();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if(button != null)
|
|
{
|
|
canvasGroup.alpha = button.interactable ? interactable : notInteractable;
|
|
}
|
|
}
|
|
}
|
|
|
|
} |