Skip to content

Commit 9eee4bb

Browse files
authored
Merge pull request #70 from mewlist/mewlist/fix-race-condition-of-addressables-assets-loading
Fix race condition of addressables asset loading
2 parents 9e871f9 + d3b20c2 commit 9eee4bb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Runtime/Assets/Resolvers/AddressableAssetResolver.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ private async ValueTask<T> LoadAsync()
4444
T instance = default;
4545
await TaskQueue.EnqueueAsync(async ct =>
4646
{
47-
if (Instance is not null) return;
47+
if (Instance is not null)
48+
{
49+
// Already loaded
50+
instance = Instance;
51+
return;
52+
}
4853
instance = await AssetLoader.LoadAsync<T>(RuntimeKey, ct);
4954
}).OnException(Debug.LogException);
5055
return instance;

0 commit comments

Comments
 (0)