Cannot find child entity of parent "Root" - Editor error, can't delete entities

There is a infrequent bug that we have been unable to reproduce on our team where users are unable to delete entities in the scene and will have some error when opening the Editor like this:

Cannot find child entity 2fba0d54-fba5-4aae-bfc4-7c56602ec495 of parent "Root" (3272fa01-fd89-11eb-9b62-026349a27a7c)

This is because there is an extra entity under the parent entity that doesn’t exist.

To fix this, you can do the following:

  • Make a branch or a checkpoint
  • In the browser dev console: const entity = editor.entities.get('XXXX') where XXXX is the GUID of the parent. In the example above, this would be 3272fa01-fd89-11eb-9b62-026349a27a7c
  • Copy and paste the following code in the browser dev console where XXX would be the child entity GUID
(function(removeGuid) {
    const children = entity.get('children');
    const newChildren = [];
    for(let i = 0; i < children.length; i++) {
        if (children[i] !== removeGuid) {
            console.log(children[i]);
            newChildren.push(children[i]);
        }
    }
    entity.set('children', newChildren);
})('XXXX') // This would be '2fba0d54-fba5-4aae-bfc4-7c56602ec495' in this example
  • Refresh the tab

If you do hit this issue, please do let us know in this thread and any information you can remember of the steps you did to get to this point. Any information will help us find a reproducible case of this issue happening.

3 Likes

Example video of steps

Hi, I somehow reproduce this issue in a simple way.

  1. Create an empty Entity named “child” and make a new template from this.
  2. Create another empty Entity named “parent” and attach “child” to “parent” as a child entity and duplicate “child”, then make a new template from this.
  3. Duplicate “parent”. At this point, duplicated “parent” has 2 “child” which has diff “+child/-child”. (there is no diffs on “parent” entity, but 2 diffs on “child” entity, I don’t know why)
  4. Do “REVERT ALL” to one of “child” entities. You can see “child” entity deleted on the “parent” entity that is NOT duplicated.
  5. Delete the “child” entity which is on the DUPLICATED “parent” and which you did “REVERT ALL”.

I think you can’t delete any entity after these procedure.

2 Likes

@vaios will be excited to know there’s a repro. Thanks!