Playcanvas Error only on first run directly from editor

This error doesn’t happen in the builds and also doesn’t happen after consecutive runs. It just happens the first time I run the game from the editor so I assume its something to do with the link between the live editor and the game. How can I resolve this?

viewport-error-console.js:159 TypeError: Cannot read properties of null (reading 'model')
    at CollisionMeshSystemImpl.doRecreatePhysicalShape (playcanvas-1.68.1.js:47239:13)

Sounds like something is still loading when this is called. On consecutive runs, the browser grabs it from the cache. To reproduce, clear your cache after the first run. You should place a breakpoint there and see what entity that is and check that the related assets are marked to be preloaded (or preload them before adding collision).

1 Like

Hey @Grimmy. Are you able to share a link to the project, so we can debug?