Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation error with UniTask #680

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Threading;
#if UNITY_2023_1_OR_NEWER
using UnityEngine;
#elif VCONTAINER_UNITASK_INTEGRATION
#if VCONTAINER_UNITASK_INTEGRATION
using Awaitable = Cysharp.Threading.Tasks.UniTask;
#elif UNITY_2023_1_OR_NEWER
using UnityEngine;
#else
using Awaitable = System.Threading.Tasks.Task;
#endif
Expand Down
29 changes: 14 additions & 15 deletions VContainer/Assets/VContainer/Runtime/Unity/PlayerLoopItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,30 +311,29 @@ public bool MoveNext()
#if VCONTAINER_UNITASK_INTEGRATION
var task = x.StartAsync(cts.Token);
if (exceptionHandler != null)
{
task.Forget(ex => exceptionHandler.Publish(ex));
}
else
{
task.Forget();
}
#else
InvokeStartAsync(x);
try
{
var task = x.StartAsync(cts.Token);
_ = task.Forget(exceptionHandler);
}
catch (Exception ex)
{
if (exceptionHandler == null) throw;
exceptionHandler.Publish(ex);
}
#endif
}
return false;
}

private void InvokeStartAsync(IAsyncStartable x)
{
try
{
var task = x.StartAsync(cts.Token);
_ = task.Forget(exceptionHandler);
}
catch (Exception ex)
{
if (exceptionHandler == null) throw;
exceptionHandler.Publish(ex);
}
}

public void Dispose()
{
lock (entries)
Expand Down
Loading