AxibugEmuOnline/AxibugEmuOnline.Client/Assets/Script/UI/AutoRaycastCanvasGroup.cs
2024-11-28 10:08:49 +08:00

17 lines
448 B
C#

using UnityEngine;
namespace AxibugEmuOnline.Client
{
[RequireComponent(typeof(CanvasGroup))]
public class AutoRaycastCanvasGroup : MonoBehaviour
{
private CanvasGroup canvasGroup;
private void Update()
{
if (canvasGroup == null) canvasGroup = gameObject.GetComponent<CanvasGroup>();
canvasGroup.blocksRaycasts = canvasGroup.alpha == 0 ? false : true;
}
}
}