Skip to content

Commit 5c6678b

Browse files
committed
fix: code generation
1 parent a06084d commit 5c6678b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Scripts/Editor/Core/CodeGenerationUtility.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,14 @@ private static void WriteNonAutomaticallyLoadedCollectionItems(ScriptableObjectC
588588
AppendLine(writer, indentation, "{");
589589
indentation++;
590590
AppendLine(writer, indentation, $"collectionHandle = Addressables.LoadAssetAsync<{collection.GetType().FullName}>(\"{entry.guid}\");");
591+
AppendLine(writer, indentation, "collectionHandle.Completed += operation =>");
592+
AppendLine(writer, indentation, "{");
593+
indentation++;
594+
AppendLine(writer, indentation, "CollectionsRegistry.Instance.RegisterCollection(operation.Result);");
595+
AppendLine(writer, indentation, $"{HasCachedValuesName} = true;");
596+
AppendLine(writer, indentation, $"{PrivateValuesName} = operation.Result;");
597+
indentation--;
598+
AppendLine(writer, indentation, "};");
591599
AppendLine(writer, indentation, "return collectionHandle;");
592600
indentation--;
593601
AppendLine(writer, indentation, "}");

0 commit comments

Comments
 (0)