resolveDuplicatedEntityReferenceProperties is not a function
Description
The Flying Toasters scene no longer runs. The following error message is displayed in the JS console:
Uncaught TypeError: newEntity.script.resolveDuplicatedEntityReferenceProperties is not a function
at resolveDuplicatedEntityReferenceProperties (playcanvas-stable.dbg.js:36191)
at Entity.clone (playcanvas-stable.dbg.js:36146)
at Spawner.spawn (spawner.js:11)
at Spawner.initialize (spawner.js:17)
at ScriptLegacyComponentSystem._callInstancesMethod (playcanvas-stable.dbg.js:26399)
at ScriptLegacyComponentSystem._initializeScriptComponent (playcanvas-stable.dbg.js:26404)
at ScriptLegacyComponentSystem.onInitialize (playcanvas-stable.dbg.js:26370)
at ScriptLegacyComponentSystem.onInitialize (playcanvas-stable.dbg.js:26376)
at ScriptLegacyComponentSystem.onInitialize (playcanvas-stable.dbg.js:26376)
at Function.fire (playcanvas-stable.dbg.js:807)
Steps to Reproduce
- Run this scene: https://playcanvas.com/editor/scene/330459
- Check JS console.
- You should see:

This function is part of ScriptComponent, so tried to figure out why it is 'newEntity.script' rather then newEntity.c.script? Could it be the actual issue? If not where this newEntity.script is being created?
No. The problem is because we have a legacy script component which is preserved to support older projects:
https://github.com/playcanvas/engine/tree/master/src/framework/components/script-legacy
We select which script component to use here:
https://github.com/playcanvas/engine/blob/master/src/framework/application.js#L473
So the problem is because resolveDuplicatedEntityReferenceProperties is defined for the current script component, but when it was added, attention was not given to the legacy script component.
We didn't have entity attributes when the legacy script component was the default, so I'm not entirely sure what the right thing to do is. @daredevildave?
Probably just need to add a check for pc.script.legacy before calling this behaviour
Sounds like a good solution. Done.