/Delay-Unity3D

Simple delay class to execute code after a certain amount of time in Unity

Primary LanguageC#The UnlicenseUnlicense

Delay

Simple delay class to execute code after a certain amount of time in Unity.

openupm

Installation

There are multiple ways to install this package into your project:

  • Add it to your project through OpenUPM (recommended)
  • Add the package to the Unity package manager using the HTTPS URL of this repository (recommended)
  • Download the whole repository as a .zip and place the contents into a subfolder in your assets folder
  • Fork the repository and add it as a submodule in git

Usage

using Timing;
using UnityEngine;

public class FooBar : MonoBehaviour
{
    public void Start()
    {
        Delay.Create(1f, () => Debug.Log("I will be executed after 1 second."));
        
        Delay.WaitUntil(() => Time.time >= 5f, () => Debug.Log("I will wait until the provided condition is true."));
    }
}

Collaboration

Support this project with a ⭐️, report an issue or if you feel adventurous and would like to extend the functionality open a pull request.