Last active
March 31, 2024 07:36
-
-
Save Trissiklikk/a010237e2d64db62419616f3973d73af to your computer and use it in GitHub Desktop.
HelperWaitForSeconds.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections.Generic; | |
public static class HelperWaitForSeconds | |
{ | |
static readonly Dictionary<float, WaitForSeconds> WaitForSeconds = new Dictionary<float, WaitForSeconds>(); | |
/// <summary> | |
/// This method is used to get WaitForSeconds clss with the specified seconds with out creating new WaitForSeconds. | |
/// </summary> | |
/// <param name="seconds"></param> | |
/// <returns></returns> | |
public static WaitForSeconds Get(float seconds) | |
{ | |
if (!WaitForSeconds.ContainsKey(seconds)) | |
WaitForSeconds.Add(seconds, new WaitForSeconds(seconds)); | |
return WaitForSeconds[seconds]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment