diff --git a/Assets/BetterExtensions/Runtime/Extension/TasksExtension/TaskExtensions.cs b/Assets/BetterExtensions/Runtime/Extension/TasksExtension/TaskExtensions.cs index d573823..f60a5b3 100644 --- a/Assets/BetterExtensions/Runtime/Extension/TasksExtension/TaskExtensions.cs +++ b/Assets/BetterExtensions/Runtime/Extension/TasksExtension/TaskExtensions.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; +using UnityEngine; namespace Better.Extensions.Runtime.TasksExtension { @@ -44,6 +46,11 @@ public static async Task WaitUntil(Func condition, int frequency = 25, int throw new TimeoutException(); } + public static async void Forget(this Task task) + { + await task; + } + /// /// Creates task with factory method /// @@ -59,5 +66,26 @@ public static Task WhenAll(this IEnumerable tasks) { return Task.WhenAll(tasks); } + + public static Task WhenAll(this IEnumerable> tasks) + { + return Task.WhenAll(tasks); + } + + public static Task WhenAny(this IEnumerable tasks) + { + return Task.WhenAny(tasks); + } + + public static async Task WhenAny(this IEnumerable> tasks) + { + var task = await Task.WhenAny(tasks); + return await task; + } + + public static Task WaitForSeconds(float seconds, CancellationToken cancellationToken = default) + { + return Task.Delay(Mathf.RoundToInt(seconds * 1000), cancellationToken); + } } } \ No newline at end of file diff --git a/Assets/BetterExtensions/package.json b/Assets/BetterExtensions/package.json index 36fc295..27aa07e 100644 --- a/Assets/BetterExtensions/package.json +++ b/Assets/BetterExtensions/package.json @@ -2,7 +2,7 @@ "name": "com.uurha.betterextensions", "displayName": "Better Extensions", "description": "Unity extensions, serialize extension, async extension, string extension and UI extensions", - "version": "1.1.99", + "version": "1.2.0", "unity": "2020.1", "author": { "name": "Better Plugins",