Fixed relay loading

This commit is contained in:
2026-05-20 11:19:41 +01:00
parent 470f1de835
commit 8d3998945a
15 changed files with 367 additions and 250 deletions

View File

@@ -1,5 +1,6 @@
using System.Threading.Tasks;
using System.Collections;
using UnityEngine;
namespace PashaBibko.PenguinChase.Extensions
{
@@ -10,6 +11,20 @@ namespace PashaBibko.PenguinChase.Extensions
public static class TaskExtensions
{
public static IEnumerator Await(this Task task)
{
// Waits until the task is completed
while (!task.IsCompleted)
{
yield return null;
}
if (task.IsFaulted)
{
Debug.LogError($"Task failed: [{task.Exception?.InnerException?.Message}]");
}
}
public static IEnumerator Await<T>(this Task<T> task, Result<T> result)
where T : class
{
@@ -19,6 +34,11 @@ namespace PashaBibko.PenguinChase.Extensions
yield return null;
}
if (task.IsFaulted)
{
Debug.LogError($"Task failed: [{task.Exception?.InnerException?.Message}]");
}
// Has to return the value like this because of the wonders of C#
result.Value = task.Result;
}