Deleting instantiated template level

Hi,
I am instantiating a template which has plenty of entities in it. It’s basically a level. After completing the level when I try to destroy the instantiated entity(level), the memory access goes out of bounds. What can go wrong here?

Anyone got any idea about this?

perhaps attach the error from the dev console, the call stack might give people some idea of where the problem could be

RuntimeError: memory access out of bounds
at https://launch.playcanvas.com/api/assets/files/Lib/Ammo/ammo.wasm.wasm?id=193562147&branchId=25828f33-f009-4382-958d-9c9c4239391d&t=a6819ea71a53e67f1dfe3e42957c2971:wasm-function[1805]:0x79126
at https://launch.playcanvas.com/api/assets/files/Lib/Ammo/ammo.wasm.wasm?id=193562147&branchId=25828f33-f009-4382-958d-9c9c4239391d&t=a6819ea71a53e67f1dfe3e42957c2971:wasm-function[1799]:0x77506
at https://launch.playcanvas.com/api/assets/files/Lib/Ammo/ammo.wasm.wasm?id=193562147&branchId=25828f33-f009-4382-958d-9c9c4239391d&t=a6819ea71a53e67f1dfe3e42957c2971:wasm-function[621]:0x33952
at https://launch.playcanvas.com/api/assets/files/Lib/Ammo/ammo.wasm.wasm?id=193562147&branchId=25828f33-f009-4382-958d-9c9c4239391d&t=a6819ea71a53e67f1dfe3e42957c2971:wasm-function[1902]:0x88865
at https://launch.playcanvas.com/api/assets/files/Lib/Ammo/ammo.wasm.wasm?id=193562147&branchId=25828f33-f009-4382-958d-9c9c4239391d&t=a6819ea71a53e67f1dfe3e42957c2971:wasm-function[627]:0x33d1f
at https://launch.playcanvas.com/api/assets/files/Lib/Ammo/ammo.wasm.wasm?id=193562147&branchId=25828f33-f009-4382-958d-9c9c4239391d&t=a6819ea71a53e67f1dfe3e42957c2971:wasm-function[1917]:0x89a51
at https://launch.playcanvas.com/api/assets/files/Lib/Ammo/ammo.wasm.wasm?id=193562147&branchId=25828f33-f009-4382-958d-9c9c4239391d&t=a6819ea71a53e67f1dfe3e42957c2971:wasm-function[557]:0x2c6b7
at x.stepSimulation (https://launch.playcanvas.com/api/assets/files/Lib/Ammo/ammo.wasm.js?id=193562146&branchId=25828f33-f009-4382-958d-9c9c4239391d&t=6b7ab3989e4f9f17c86e44380f9181c6:507:451)
at RigidBodyComponentSystem.onUpdate (https://code.playcanvas.com/playcanvas-1.74.0.dbg.js:101497:25)
at ComponentSystemRegistry.fire (https://code.playcanvas.com/playcanvas-1.74.0.dbg.js:1668:21)

@mvaligursky any idea about this error?

I got the same error when trying to generate a collision mesh with more than 4096 subdivisions. Are you using a mesh collider anywhere by chance?

Yes using a mesh collider for boundary

Those have some weird bug. Try and switch to something else

I’m guessing the bug is when the mesh collider has to many triangles, so maybe switch to a lower poly collision mesh if the shape is necessary

Well I am already using low poly meshes.

Interesting. Either way, I have no further advice.

Without a repro, sounds like you may be deleting an object in the mid of a step update in the physics? (perhaps in a collision call back?)