Skip to content
This repository was archived by the owner on Aug 15, 2024. It is now read-only.

Commit 6711ba2

Browse files
author
serg.morozov
committed
fix: addressables new version bug - duplicate load
1 parent 07e7f3f commit 6711ba2

File tree

6 files changed

+27
-19
lines changed

6 files changed

+27
-19
lines changed
Binary file not shown.

Assets/com.nuclearband.sodatabase/Runtime/SODatabase.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,14 @@ public static async Task InitAsync(Action<float>? onProgress, Action? onComplete
5555
#pragma warning restore 4014
5656
var resourceLocations = await loadHandler.Task;
5757

58-
var loadTasks = resourceLocations.ToDictionary(resourceLocation => resourceLocation.PrimaryKey.Substring(SODatabaseSettings.Path.Length), resourceLocation => Addressables.LoadAssetAsync<DataNode>(resourceLocation).Task);
58+
var loadTasks = new Dictionary<string, Task<DataNode>>();
59+
foreach (var resourceLocation in resourceLocations)
60+
{
61+
var key = resourceLocation.PrimaryKey.Substring(SODatabaseSettings.Path.Length);
62+
if (!resourceLocation.ResourceType.IsSubclassOf(typeof(DataNode)) || loadTasks.ContainsKey(key))
63+
continue;
64+
loadTasks.Add(key, Addressables.LoadAssetAsync<DataNode>(resourceLocation).Task);
65+
}
5966
await Task.WhenAll(loadTasks.Values);
6067
root = new FolderHolder();
6168
foreach (var loadTask in loadTasks)
@@ -71,7 +78,7 @@ public static async Task InitAsync(Action<float>? onProgress, Action? onComplete
7178
curFolder = curFolder.FolderHolders[pathElements[i]];
7279
}
7380

74-
var dataNodeName = pathElements[pathElements.Length - 1];
81+
var dataNodeName = pathElements[^1];
7582
dataNodeName = dataNodeName.Substring(0, dataNodeName.IndexOf(".asset", StringComparison.Ordinal));
7683
curFolder.DataNodes.Add(dataNodeName, loadTask.Value.Result);
7784
}

Packages/manifest.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"dependencies": {
3-
"com.unity.addressables": "1.19.17",
4-
"com.unity.ide.rider": "3.0.9",
5-
"com.unity.ide.visualstudio": "2.0.12",
6-
"com.unity.ide.vscode": "1.2.4",
3+
"com.unity.addressables": "1.19.19",
4+
"com.unity.ide.rider": "3.0.13",
5+
"com.unity.ide.visualstudio": "2.0.14",
6+
"com.unity.ide.vscode": "1.2.5",
77
"com.unity.nuget.newtonsoft-json": "2.0.2",
8-
"com.unity.test-framework": "1.1.30",
8+
"com.unity.test-framework": "1.1.31",
99
"com.unity.textmeshpro": "3.0.6",
10-
"com.unity.timeline": "1.6.3",
10+
"com.unity.timeline": "1.6.4",
1111
"com.unity.ugui": "1.0.0",
1212
"com.unity.modules.ai": "1.0.0",
1313
"com.unity.modules.androidjni": "1.0.0",

Packages/packages-lock.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"dependencies": {
33
"com.unity.addressables": {
4-
"version": "1.19.17",
4+
"version": "1.19.19",
55
"depth": 0,
66
"source": "registry",
77
"dependencies": {
8-
"com.unity.scriptablebuildpipeline": "1.19.5",
8+
"com.unity.scriptablebuildpipeline": "1.19.6",
99
"com.unity.modules.assetbundle": "1.0.0",
1010
"com.unity.modules.imageconversion": "1.0.0",
1111
"com.unity.modules.jsonserialize": "1.0.0",
@@ -22,7 +22,7 @@
2222
"url": "https://packages.unity.com"
2323
},
2424
"com.unity.ide.rider": {
25-
"version": "3.0.9",
25+
"version": "3.0.13",
2626
"depth": 0,
2727
"source": "registry",
2828
"dependencies": {
@@ -31,7 +31,7 @@
3131
"url": "https://packages.unity.com"
3232
},
3333
"com.unity.ide.visualstudio": {
34-
"version": "2.0.12",
34+
"version": "2.0.14",
3535
"depth": 0,
3636
"source": "registry",
3737
"dependencies": {
@@ -40,7 +40,7 @@
4040
"url": "https://packages.unity.com"
4141
},
4242
"com.unity.ide.vscode": {
43-
"version": "1.2.4",
43+
"version": "1.2.5",
4444
"depth": 0,
4545
"source": "registry",
4646
"dependencies": {},
@@ -54,14 +54,14 @@
5454
"url": "https://packages.unity.com"
5555
},
5656
"com.unity.scriptablebuildpipeline": {
57-
"version": "1.19.5",
57+
"version": "1.19.6",
5858
"depth": 1,
5959
"source": "registry",
6060
"dependencies": {},
6161
"url": "https://packages.unity.com"
6262
},
6363
"com.unity.test-framework": {
64-
"version": "1.1.30",
64+
"version": "1.1.31",
6565
"depth": 0,
6666
"source": "registry",
6767
"dependencies": {
@@ -81,7 +81,7 @@
8181
"url": "https://packages.unity.com"
8282
},
8383
"com.unity.timeline": {
84-
"version": "1.6.3",
84+
"version": "1.6.4",
8585
"depth": 0,
8686
"source": "registry",
8787
"dependencies": {

ProjectSettings/ProjectSettings.asset

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ PlayerSettings:
753753
webGLThreadsSupport: 0
754754
webGLDecompressionFallback: 0
755755
scriptingDefineSymbols:
756-
Android: ODIN_INSPECTOR
756+
Android: ODIN_INSPECTOR;ODIN_INSPECTOR_3
757757
Standalone: ODIN_INSPECTOR
758758
additionalCompilerArguments: {}
759759
platformArchitecture: {}
@@ -799,6 +799,7 @@ PlayerSettings:
799799
metroFTAName:
800800
metroFTAFileTypes: []
801801
metroProtocolName:
802+
vcxProjDefaultLanguage:
802803
XboxOneProductId:
803804
XboxOneUpdateKey:
804805
XboxOneSandboxId:

ProjectSettings/ProjectVersion.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
m_EditorVersion: 2021.2.6f1
2-
m_EditorVersionWithRevision: 2021.2.6f1 (8c4e826ba445)
1+
m_EditorVersion: 2021.2.19f1
2+
m_EditorVersionWithRevision: 2021.2.19f1 (602ecdbb2fb0)

0 commit comments

Comments
 (0)