quantum-space-buddies/QSB/Utility/UnityHelper.cs

28 lines
575 B
C#
Raw Normal View History

2020-08-09 07:17:00 +00:00
using System;
using System.Collections;
using UnityEngine;
namespace QSB.Utility
{
public class UnityHelper : MonoBehaviour
{
public static UnityHelper Instance { get; private set; }
private void Awake()
{
Instance = this;
}
public void RunWhen(Func<bool> when, Action what)
{
StartCoroutine(WaitUntil(when, what));
}
private IEnumerator WaitUntil(Func<bool> when, Action what)
{
yield return new WaitUntil(when);
what();
}
}
}