修复上下文bug

This commit is contained in:
2025-12-15 11:54:58 +08:00
parent 0c79cd874e
commit 8ed4f93e24

View File

@@ -318,8 +318,12 @@ namespace Demo
return; return;
} }
this.Parent = parent; this.Parent = parent;
if (parent != null) if (parent != null && parent.ScriptableObjectContents.IsCreated)
{ {
if (ScriptableObjectContents.IsCreated == false)
{
ScriptableObjectContents = new(parent.ScriptableObjectContents.Count, AllocatorManager.Persistent);
}
foreach (var item in parent.ScriptableObjectContents) foreach (var item in parent.ScriptableObjectContents)
{ {
this.ScriptableObjectContents[item.Key] = item.Value; this.ScriptableObjectContents[item.Key] = item.Value;
@@ -612,7 +616,8 @@ namespace Demo
} }
// 释放资源 // 释放资源
{ {
this.ScriptableObjectContents.Dispose(); if (this.ScriptableObjectContents.IsCreated)
this.ScriptableObjectContents.Dispose();
} }
IsScriptApply = true; IsScriptApply = true;
} }