Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/framework/components/script/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ class ScriptComponent extends Component {
// otherwise it means that the attributes have already been initialized
// so convert the new guid to an entity
// and put it in the new attributes
const newAttributesRaw = newScriptComponent[scriptName].__attributesRaw;
const newAttributesRaw = newScriptComponent[scriptName].__attributesRaw ?? newScriptComponent._attributeDataMap.get(scriptName);
const newAttributes = newScriptComponent[scriptName].__attributes;
if (!newAttributesRaw && !newAttributes) {
continue;
Expand All @@ -979,14 +979,15 @@ class ScriptComponent extends Component {
const useGuid = !!newAttributesRaw;

// get the old script attributes from the instance
const oldAttributes = script.instance.__attributes;
const oldAttributes = script.instance.__attributes ?? newScriptComponent._attributeDataMap.get(scriptName);
for (const attributeName in oldAttributes) {
if (!oldAttributes[attributeName]) {
continue;
}

// get the attribute definition from the script type
const attribute = scriptType.attributes.get(attributeName);
const attribute = scriptType.attributes?.get(attributeName) ??
this.system.app.scripts.getSchema(scriptName)?.attributes?.[attributeName];
if (!attribute) {
continue;
}
Expand Down