Files
cloud-mainworld/ufm cloud/Assets/#User/Community Modules/Scripts/Interactions Plugin/ObjectTriggerStay.cs
T
wub f0ff43f54a CLUB
clib lights and arragement along with fixes for new networking
2026-10-26 18:17:30 +00:00

27 lines
859 B
C#

using UnityEngine;
using UnityEngine.Events;
namespace UFMTESTING1
{
public class ObjectTriggerStay : MonoBehaviour
{
public UnityEvent OnStay;
[Header("Optional (Ingored if empty)")]
[SerializeField] private LayerMask _objectLayer = ~0;
[SerializeField] private string _objectName = "";
[SerializeField] private string _objectTag = "";
private void OnTriggerStay(Collider other)
{
bool isLayerPass = (_objectLayer & 1 << other.gameObject.layer) != 0;
bool isNamePass = _objectName.Length == 0 || other.gameObject.name == _objectName;
bool isTagPass = _objectTag.Length == 0 || other.gameObject.CompareTag(_objectTag);
if (isLayerPass && isNamePass && isTagPass)
{
OnStay?.Invoke();
}
}
}
}