Cannot duplicate entities - Editor says 'Error saving changes'

@yaustar Hey, I ran into this issue today and managed to get it working using the branch merge option. However, as someone else here mentioned, now I can’t duplicate entities (some at least, or it’s completely random, I can’t tell).

Is that fixable too? I’m a bit desperate now :slight_smile:

Can you share the project url here or via DM please? And also the exact steps to reproduce the issue?

(Ie which branch, scene, entity, how you duplicate etc)

DM sent :slight_smile:

@eilsoe I’ve investigated the issue on your project and it is separate from Cannot find child entity of parent "Root" - Editor error, can't delete entities.

Your scene hierarchy JSON is on the border of being the maximum size it can be. After duplicating the entity that you mentioned in the DM, it has the following error on the console:

Error: Query size 16815457 exceeded maximum query size 16793600
    at y (share.uncompressed.js:8187:13)
    at v.handleMessage (share.uncompressed.js:8113:11)
    at e.onmessage (share.uncompressed.js:8064:18)
    at _socket.onmessage (index.mjs:6408:17)

The max size a scene can be is 15MB of JSON. Duplicating a set of entities goes over that size.

To mitigate this, I generally recommend using multiple scenes rather than one big scene.

This way, you can load the other scenes additively at runtime when you need them. See more here: Loading Scenes | Learn PlayCanvas

Alternatively, you can ‘lazy load’ by creating template instances or loading scenes

Example with Template: https://playcanvas.com/project/692381/overview/lazy-load-with-template-proxy
Example with Scenes https://playcanvas.com/project/949030/overview/lazy-load-scenes

In your case, you can have one scene per vehicle and when you need it, you can do the loading of that scene additively at runtime.

This has the added benefit that the base/main scene is much smaller and faster to load for your users.

1 Like

Thanks! I’ll give this a go then :slight_smile: