Compare commits

..

11 Commits

Author SHA1 Message Date
Ikiru Yoshizaki
e5acc106ee Merge pull request #715 from Cysharp/ci/nuget
ci: use OIDC for NuGet package push authentication
2026-05-20 21:40:43 +09:00
Ikiru Yoshizaki
b0d26bebea ci: add dedicated publish job gated on build and build-unity 2026-05-20 19:38:57 +09:00
Ikiru Yoshizaki
4cfac5c9d2 ci: fix symbol generation options 61d8d3 2026-05-20 18:59:38 +09:00
Ikiru Yoshizaki
37251f09d4 ci: publish symbol files 2026-05-20 18:22:01 +09:00
Ikiru Yoshizaki
a18e8e38da ci: handle SymbolPackageFormat on build 2026-05-20 18:06:57 +09:00
Ikiru Yoshizaki
19b01fe8d6 ci: id-token permission 2026-05-20 16:48:40 +09:00
Ikiru Yoshizaki
a09a450b0f ci: use OIDC for NuGet package push authentication
This updates the build-release workflow to leverage OpenID Connect (OIDC) for authenticating with NuGet.org. The package push operation is now performed directly within the build job, replacing static API key usage with ephemeral credentials for enhanced security.
2026-05-20 16:12:26 +09:00
github-actions[bot]
2e993ff18f chore(automate): Update package.json to 2.5.11
Commit by [GitHub Actions](https://github.com/Cysharp/UniTask/actions/runs/26083685280)
2026-05-19 07:47:19 +00:00
Yoshifumi Kawai
f248391774 Merge pull request #706 from chikacc/master
fix: resolve TreeView deprecation in Unity 6.2+
2026-05-19 16:46:26 +09:00
Chika Chang
0d304f1feb fix: resolve TreeView deprecation in Unity 6.2+ 2026-03-28 15:36:49 +08:00
Ikiru Yoshizaki
a9e27c03d4 chore: add groups for dependabot 2026-02-25 18:03:24 +09:00
7 changed files with 51 additions and 178 deletions

View File

@@ -5,6 +5,10 @@ updates:
directory: "/" directory: "/"
schedule: schedule:
interval: "weekly" # Check for updates to GitHub Actions every week interval: "weekly" # Check for updates to GitHub Actions every week
groups:
dependencies:
patterns:
- "*"
cooldown: cooldown:
default-days: 14 # Wait 14 days before creating another PR for the same dependency. This will prevent vulnerability on the package impact. default-days: 14 # Wait 14 days before creating another PR for the same dependency. This will prevent vulnerability on the package impact.
ignore: ignore:

View File

@@ -35,10 +35,10 @@ jobs:
with: with:
ref: ${{ needs.update-packagejson.outputs.sha }} ref: ${{ needs.update-packagejson.outputs.sha }}
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main - uses: Cysharp/Actions/.github/actions/setup-dotnet@main
# build and pack # build and pack nuget (.nupkg and .symbols.nupkg will be created)
- run: dotnet build -c Release -p:Version=${{ inputs.tag }} - run: dotnet build -c Release -p:Version=${{ inputs.tag }}
- run: dotnet test -c Release --no-build - run: dotnet test -c Release --no-build
- run: dotnet pack ./src/UniTask.NetCore/UniTask.NetCore.csproj -c Release --no-build -p:Version=${{ inputs.tag }} -o ./publish - run: dotnet pack ./src/UniTask.NetCore/UniTask.NetCore.csproj -c Release --no-build -p:Version=${{ inputs.tag }} -p:IncludeSymbols=true -o ./publish
# Store artifacts. # Store artifacts.
- uses: Cysharp/Actions/.github/actions/upload-artifact@main - uses: Cysharp/Actions/.github/actions/upload-artifact@main
with: with:
@@ -96,9 +96,32 @@ jobs:
path: ./src/UniTask/UniTask.${{ inputs.tag }}.unitypackage path: ./src/UniTask/UniTask.${{ inputs.tag }}.unitypackage
retention-days: 1 retention-days: 1
# publish
publish:
name: "Publish NuGet packages"
needs: [build-dotnet, build-unity]
permissions:
contents: read
id-token: write # required for NuGet Trusted Publish
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
- uses: Cysharp/Actions/.github/actions/download-artifact@main
# push nuget
- name: NuGet login (OIDC)
uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0
id: login
with:
user: ${{ secrets.NUGET_USER }}
- run: dotnet nuget push "./nuget/*.nupkg" --skip-duplicate -s https://api.nuget.org/v3/index.json -k "${NUGET_KEY}"
if: ${{ !inputs.dry-run }}
env:
NUGET_KEY: ${{ steps.login.outputs.NUGET_API_KEY }}
# release # release
create-release: create-release:
needs: [update-packagejson, build-dotnet, build-unity] needs: [update-packagejson, publish]
permissions: permissions:
contents: write contents: write
id-token: write # required for NuGet Trusted Publish id-token: write # required for NuGet Trusted Publish
@@ -107,14 +130,14 @@ jobs:
commit-id: ${{ needs.update-packagejson.outputs.sha }} commit-id: ${{ needs.update-packagejson.outputs.sha }}
dry-run: ${{ inputs.dry-run }} dry-run: ${{ inputs.dry-run }}
tag: ${{ inputs.tag }} tag: ${{ inputs.tag }}
nuget-push: true nuget-push: false
release-upload: true release-upload: true
release-asset-path: ./UniTask.${{ inputs.tag }}.unitypackage/UniTask.${{ inputs.tag }}.unitypackage release-asset-path: ./UniTask.${{ inputs.tag }}.unitypackage/UniTask.${{ inputs.tag }}.unitypackage
secrets: inherit secrets: inherit
cleanup: cleanup:
if: ${{ needs.update-packagejson.outputs.is-branch-created == 'true' }} if: ${{ needs.update-packagejson.outputs.is-branch-created == 'true' }}
needs: [update-packagejson, build-dotnet, build-unity] needs: [update-packagejson, create-release]
permissions: permissions:
contents: write contents: write
uses: Cysharp/Actions/.github/workflows/clean-packagejson-branch.yaml@main uses: Cysharp/Actions/.github/workflows/clean-packagejson-branch.yaml@main

View File

@@ -10,6 +10,11 @@ using UnityEditor.IMGUI.Controls;
using Cysharp.Threading.Tasks.Internal; using Cysharp.Threading.Tasks.Internal;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
#if UNITY_6000_2_OR_NEWER
using TreeView = UnityEditor.IMGUI.Controls.TreeView<int>;
using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem<int>;
using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState<int>;
#endif
namespace Cysharp.Threading.Tasks.Editor namespace Cysharp.Threading.Tasks.Editor
{ {
@@ -179,4 +184,3 @@ namespace Cysharp.Threading.Tasks.Editor
} }
} }

View File

@@ -118,9 +118,6 @@ namespace Cysharp.Threading.Tasks.Internal
case PlayerLoopTiming.LastPostLateUpdate: case PlayerLoopTiming.LastPostLateUpdate:
LastPostLateUpdate(); LastPostLateUpdate();
break; break;
case PlayerLoopTiming.ManualUpdate:
ManualUpdate();
break;
#if UNITY_2020_2_OR_NEWER #if UNITY_2020_2_OR_NEWER
case PlayerLoopTiming.TimeUpdate: case PlayerLoopTiming.TimeUpdate:
TimeUpdate(); TimeUpdate();
@@ -151,7 +148,6 @@ namespace Cysharp.Threading.Tasks.Internal
void LastPreLateUpdate() => RunCore(); void LastPreLateUpdate() => RunCore();
void PostLateUpdate() => RunCore(); void PostLateUpdate() => RunCore();
void LastPostLateUpdate() => RunCore(); void LastPostLateUpdate() => RunCore();
void ManualUpdate() => RunCore();
#if UNITY_2020_2_OR_NEWER #if UNITY_2020_2_OR_NEWER
void TimeUpdate() => RunCore(); void TimeUpdate() => RunCore();
void LastTimeUpdate() => RunCore(); void LastTimeUpdate() => RunCore();
@@ -182,7 +178,7 @@ namespace Cysharp.Threading.Tasks.Internal
} }
else else
{ {
continue; // next i continue; // next i
} }
} }
catch (Exception ex) catch (Exception ex)

View File

@@ -96,7 +96,6 @@ namespace Cysharp.Threading.Tasks
TimeUpdate = 14, TimeUpdate = 14,
LastTimeUpdate = 15, LastTimeUpdate = 15,
#endif #endif
ManualUpdate = 16,
} }
[Flags] [Flags]
@@ -193,7 +192,6 @@ namespace Cysharp.Threading.Tasks
static SynchronizationContext unitySynchronizationContext; static SynchronizationContext unitySynchronizationContext;
static ContinuationQueue[] yielders; static ContinuationQueue[] yielders;
static PlayerLoopRunner[] runners; static PlayerLoopRunner[] runners;
static PlayerLoopRunner ManualRunner;
internal static bool IsEditorApplicationQuitting { get; private set; } internal static bool IsEditorApplicationQuitting { get; private set; }
static PlayerLoopSystem[] InsertRunner(PlayerLoopSystem loopSystem, static PlayerLoopSystem[] InsertRunner(PlayerLoopSystem loopSystem,
bool injectOnFirst, bool injectOnFirst,
@@ -253,10 +251,6 @@ namespace Cysharp.Threading.Tasks
return dest; return dest;
} }
public static void ManualUpdate()
{
ManualRunner.Run();
}
static PlayerLoopSystem[] RemoveRunner(PlayerLoopSystem loopSystem, Type loopRunnerYieldType, Type loopRunnerType) static PlayerLoopSystem[] RemoveRunner(PlayerLoopSystem loopSystem, Type loopRunnerYieldType, Type loopRunnerType)
{ {
@@ -308,7 +302,7 @@ namespace Cysharp.Threading.Tasks
catch { } catch { }
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER #if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
// When domain reload is disabled, re-initialization is required when entering play mode; // When domain reload is disabled, re-initialization is required when entering play mode;
// otherwise, pending tasks will leak between play mode sessions. // otherwise, pending tasks will leak between play mode sessions.
var domainReloadDisabled = UnityEditor.EditorSettings.enterPlayModeOptionsEnabled && var domainReloadDisabled = UnityEditor.EditorSettings.enterPlayModeOptionsEnabled &&
UnityEditor.EditorSettings.enterPlayModeOptions.HasFlag(UnityEditor.EnterPlayModeOptions.DisableDomainReload); UnityEditor.EditorSettings.enterPlayModeOptions.HasFlag(UnityEditor.EnterPlayModeOptions.DisableDomainReload);
@@ -411,8 +405,6 @@ namespace Cysharp.Threading.Tasks
runners = new PlayerLoopRunner[14]; runners = new PlayerLoopRunner[14];
#endif #endif
ManualRunner = new PlayerLoopRunner(PlayerLoopTiming.ManualUpdate);
var copyList = playerLoop.subSystemList.ToArray(); var copyList = playerLoop.subSystemList.ToArray();
// Initialization // Initialization
@@ -499,11 +491,6 @@ namespace Cysharp.Threading.Tasks
public static void AddAction(PlayerLoopTiming timing, IPlayerLoopItem action) public static void AddAction(PlayerLoopTiming timing, IPlayerLoopItem action)
{ {
if ((int)timing == (int)PlayerLoopTiming.ManualUpdate)
{
ManualRunner.AddAction(action);
return;
}
var runner = runners[(int)timing]; var runner = runners[(int)timing];
if (runner == null) if (runner == null)
{ {
@@ -541,8 +528,8 @@ namespace Cysharp.Threading.Tasks
{ {
sb.AppendFormat("------{0}------", header.type.Name); sb.AppendFormat("------{0}------", header.type.Name);
sb.AppendLine(); sb.AppendLine();
if (header.subSystemList is null) if (header.subSystemList is null)
{ {
sb.AppendFormat("{0} has no subsystems!", header.ToString()); sb.AppendFormat("{0} has no subsystems!", header.ToString());
sb.AppendLine(); sb.AppendLine();
@@ -570,11 +557,11 @@ namespace Cysharp.Threading.Tasks
foreach (var header in playerLoop.subSystemList) foreach (var header in playerLoop.subSystemList)
{ {
if (header.subSystemList is null) if (header.subSystemList is null)
{ {
continue; continue;
} }
foreach (var subSystem in header.subSystemList) foreach (var subSystem in header.subSystemList)
{ {
if (subSystem.type == typeof(UniTaskLoopRunners.UniTaskLoopRunnerInitialization)) if (subSystem.type == typeof(UniTaskLoopRunners.UniTaskLoopRunnerInitialization))

View File

@@ -16,14 +16,11 @@ namespace Cysharp.Threading.Tasks
/// <summary>Ignore timescale, use Time.unscaledDeltaTime.</summary> /// <summary>Ignore timescale, use Time.unscaledDeltaTime.</summary>
UnscaledDeltaTime, UnscaledDeltaTime,
/// <summary>use Stopwatch.GetTimestamp().</summary> /// <summary>use Stopwatch.GetTimestamp().</summary>
Realtime, Realtime
ManualTime
} }
public partial struct UniTask public partial struct UniTask
{ {
public static float deltaTime;
public static int frameCount;
public static YieldAwaitable Yield() public static YieldAwaitable Yield()
{ {
// optimized for single continuation // optimized for single continuation
@@ -83,7 +80,7 @@ namespace Cysharp.Threading.Tasks
{ {
await Awaitable.EndOfFrameAsync(cancellationToken); await Awaitable.EndOfFrameAsync(cancellationToken);
} }
#else #else
[Obsolete("Use WaitForEndOfFrame(MonoBehaviour) instead or UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate). Equivalent for coroutine's WaitForEndOfFrame requires MonoBehaviour(runner of Coroutine).")] [Obsolete("Use WaitForEndOfFrame(MonoBehaviour) instead or UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate). Equivalent for coroutine's WaitForEndOfFrame requires MonoBehaviour(runner of Coroutine).")]
public static YieldAwaitable WaitForEndOfFrame() public static YieldAwaitable WaitForEndOfFrame()
{ {
@@ -95,7 +92,7 @@ namespace Cysharp.Threading.Tasks
{ {
return UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate, cancellationToken, cancelImmediately); return UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate, cancellationToken, cancelImmediately);
} }
#endif #endif
public static UniTask WaitForEndOfFrame(MonoBehaviour coroutineRunner) public static UniTask WaitForEndOfFrame(MonoBehaviour coroutineRunner)
{ {
@@ -182,10 +179,6 @@ namespace Cysharp.Threading.Tasks
switch (delayType) switch (delayType)
{ {
case DelayType.ManualTime:
{
return new UniTask(DelayManualPromise.Create(delayTimeSpan, delayTiming, cancellationToken, cancelImmediately, out var token), token);
}
case DelayType.UnscaledDeltaTime: case DelayType.UnscaledDeltaTime:
{ {
return new UniTask(DelayIgnoreTimeScalePromise.Create(delayTimeSpan, delayTiming, cancellationToken, cancelImmediately, out var token), token); return new UniTask(DelayIgnoreTimeScalePromise.Create(delayTimeSpan, delayTiming, cancellationToken, cancelImmediately, out var token), token);
@@ -236,7 +229,7 @@ namespace Cysharp.Threading.Tasks
result.cancellationToken = cancellationToken; result.cancellationToken = cancellationToken;
result.cancelImmediately = cancelImmediately; result.cancelImmediately = cancelImmediately;
if (cancelImmediately && cancellationToken.CanBeCanceled) if (cancelImmediately && cancellationToken.CanBeCanceled)
{ {
result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state => result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>
@@ -327,7 +320,6 @@ namespace Cysharp.Threading.Tasks
CancellationToken cancellationToken; CancellationToken cancellationToken;
CancellationTokenRegistration cancellationTokenRegistration; CancellationTokenRegistration cancellationTokenRegistration;
bool cancelImmediately; bool cancelImmediately;
PlayerLoopTiming timing = PlayerLoopTiming.Update;
NextFramePromise() NextFramePromise()
{ {
@@ -345,9 +337,8 @@ namespace Cysharp.Threading.Tasks
result = new NextFramePromise(); result = new NextFramePromise();
} }
result.frameCount = PlayerLoopHelper.IsMainThread ?(timing == PlayerLoopTiming.ManualUpdate ? UniTask.frameCount : Time.frameCount) : -1; result.frameCount = PlayerLoopHelper.IsMainThread ? Time.frameCount : -1;
result.cancellationToken = cancellationToken; result.cancellationToken = cancellationToken;
result.timing = timing;
result.cancelImmediately = cancelImmediately; result.cancelImmediately = cancelImmediately;
if (cancelImmediately && cancellationToken.CanBeCanceled) if (cancelImmediately && cancellationToken.CanBeCanceled)
@@ -409,7 +400,7 @@ namespace Cysharp.Threading.Tasks
return false; return false;
} }
if (frameCount == (timing == PlayerLoopTiming.ManualUpdate ? UniTask.frameCount : Time.frameCount)) if (frameCount == Time.frameCount)
{ {
return true; return true;
} }
@@ -704,138 +695,6 @@ namespace Cysharp.Threading.Tasks
} }
} }
sealed class DelayManualPromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<DelayManualPromise>
{
static TaskPool<DelayManualPromise> pool;
DelayManualPromise nextNode;
public ref DelayManualPromise NextNode => ref nextNode;
static DelayManualPromise()
{
TaskPool.RegisterSizeGetter(typeof(DelayManualPromise), () => pool.Size);
}
int initialFrame;
float delayTimeSpan;
float elapsed;
CancellationToken cancellationToken;
CancellationTokenRegistration cancellationTokenRegistration;
bool cancelImmediately;
UniTaskCompletionSourceCore<object> core;
DelayManualPromise()
{
}
public static IUniTaskSource Create(TimeSpan delayTimeSpan, PlayerLoopTiming timing, CancellationToken cancellationToken, bool cancelImmediately, out short token)
{
if (cancellationToken.IsCancellationRequested)
{
return AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token);
}
if (!pool.TryPop(out var result))
{
result = new DelayManualPromise();
}
result.elapsed = 0.0f;
result.delayTimeSpan = (float)delayTimeSpan.TotalSeconds;
result.cancellationToken = cancellationToken;
result.initialFrame = PlayerLoopHelper.IsMainThread ? frameCount : -1;
result.cancelImmediately = cancelImmediately;
if (cancelImmediately && cancellationToken.CanBeCanceled)
{
result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>
{
var promise = (DelayManualPromise)state;
promise.core.TrySetCanceled(promise.cancellationToken);
}, result);
}
TaskTracker.TrackActiveTask(result, 3);
PlayerLoopHelper.AddAction(timing, result);
token = result.core.Version;
return result;
}
public void GetResult(short token)
{
try
{
core.GetResult(token);
}
finally
{
if (!(cancelImmediately && cancellationToken.IsCancellationRequested))
{
TryReturn();
}
else
{
TaskTracker.RemoveTracking(this);
}
}
}
public UniTaskStatus GetStatus(short token)
{
return core.GetStatus(token);
}
public UniTaskStatus UnsafeGetStatus()
{
return core.UnsafeGetStatus();
}
public void OnCompleted(Action<object> continuation, object state, short token)
{
core.OnCompleted(continuation, state, token);
}
public bool MoveNext()
{
if (cancellationToken.IsCancellationRequested)
{
core.TrySetCanceled(cancellationToken);
return false;
}
if (elapsed == 0.0f)
{
if (initialFrame == Time.frameCount)
{
return true;
}
}
elapsed += Time.deltaTime;
if (elapsed >= delayTimeSpan)
{
core.TrySetResult(null);
return false;
}
return true;
}
bool TryReturn()
{
TaskTracker.RemoveTracking(this);
core.Reset();
delayTimeSpan = default;
elapsed = default;
cancellationToken = default;
cancellationTokenRegistration.Dispose();
cancelImmediately = default;
return pool.TryPush(this);
}
}
sealed class DelayPromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<DelayPromise> sealed class DelayPromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<DelayPromise>
{ {
static TaskPool<DelayPromise> pool; static TaskPool<DelayPromise> pool;

View File

@@ -2,7 +2,7 @@
"name": "com.cysharp.unitask", "name": "com.cysharp.unitask",
"displayName": "UniTask", "displayName": "UniTask",
"author": { "name": "Cysharp, Inc.", "url": "https://cysharp.co.jp/en/" }, "author": { "name": "Cysharp, Inc.", "url": "https://cysharp.co.jp/en/" },
"version": "2.5.10", "version": "2.5.11",
"unity": "2018.4", "unity": "2018.4",
"description": "Provides an efficient async/await integration to Unity.", "description": "Provides an efficient async/await integration to Unity.",
"keywords": [ "async/await", "async", "Task", "UniTask" ], "keywords": [ "async/await", "async", "Task", "UniTask" ],