Editor's bug: Incorrect colliders are displayed

For some reason, the editor shows the wrong colliders for some objects, all of them are shown as boxes, on a larger scale and with the wrong materials, when playing, everything is fine, do you have any idea how to fix it?

Can you share a small public project that reproduces the issue please?

https://playcanvas.com/editor/project/1062235

It looks like the collider rendering is fine. The model box is not however as you see between the editor view and the launch tab

Deleting the model component and re-adding it fixes the render.

There’s something really weird in this project/scene that I can’t explain. For example, these boxes have the wrong materials rendering too

Oh, that’s an interesting bug. Some of your entities that have a model component of type box still have a model reference from the asset type.

See below. Basically, some of the entities aren’t rendering correctly

Problem is that I can’t recreate the bug from scratch :thinking:

To fix this, you can use the Editor API.

  1. Make a checkpoint
  2. Open up the browser dev console while in the scene editor
  3. Paste the following code
const entities = editor.entities.list();
for (const e of entities) {
    if (e.has('components.model')) {
        const c = e.get('components.model');
        if (c.type !== 'asset') {
            e.set('components.model.asset', null);
        }
    }
}
  1. Wait a bit and refresh the tab

1 Like

Thank you! What can I say, bugs happen :smiley:

The very first entity was a box at the bottom, which has a model component (not the editor’s box), and from it as a base, all other entities were duplicated, then the asset type was changed, maybe the editor somehow got confused, since all the entities are named “Box”? But anyway, I don’t know how the editor works, probably the entities are filtered by something else instead of name.

Just found out how to reproduce it:

  1. Take the first box entity and duplicate it
  2. On the duplicated box > Model > Entity Materials > Change both materials for mesh instances
  3. Duplicate the duplicated box and change model asset and collision to anything else and refresh the page