Initial commit

This commit is contained in:
Thorbjoern
2025-05-26 00:46:28 +02:00
commit e5bca03433
3896 changed files with 1434297 additions and 0 deletions
@@ -0,0 +1,30 @@
using System.Collections;
using UnityEngine;
using UnityEngine.Events;
namespace XRMultiplayer
{
public class DelayedUnityEvent : MonoBehaviour
{
[SerializeField] float m_TimeToEnable = 4.0f;
[SerializeField] UnityEvent m_UnityEvent;
Coroutine m_EnablingRoutine;
private void OnEnable()
{
if (m_EnablingRoutine != null) StopCoroutine(m_EnablingRoutine);
m_EnablingRoutine = StartCoroutine(EnableAfterTime());
}
private void OnDisable()
{
if (m_EnablingRoutine != null) StopCoroutine(m_EnablingRoutine);
}
IEnumerator EnableAfterTime()
{
yield return new WaitForSeconds(m_TimeToEnable);
m_UnityEvent.Invoke();
}
}
}