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 checkpoint
  • Branch off the checkpoint
  • Switch to the new branch
  • Merge the branch immediately back to the original

OR 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.

6 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!

We have made a fix to this to stop the original issue from occurring again: https://github.com/playcanvas/editor/releases/tag/v.1.20.5

However, if the project is currently in this broken state, then it will still need these ‘fixes’ to be applied

1 Like

I have tried these two methods. But the project still fails with the below message.

Did you try the above steps?

Yes. I did

Can you give ‘yaustar’ write access to the project and I will take a look

I have done that now.

I need write access please

Looking at the version control graph, it doesn’t look like a branch was merged back to master in the steps I’ve listed above

I’ve done this now and you should be able to continue development :slight_smile:

3 Likes

Thats amazing. Thanks a lot.

Ran into this bug as well, but the above fix worked great.

Steps leading up to bug:
1 - Launch window was running
2 - Created two entities “Lights” and “Geo” to clean up the hierarchy
3 - Dropped the lights under “Lights” and models under “Geo”
4 - Made an adjustment to the camera and saw that it wasn’t updating
5 - Relaunched the launch window and received the bug error

2 Likes

Thanks Katy, we will investigate to see if we can create a repro

Following these steps fixed our issue today.

1 Like

Thanks @jaredEL !

I don’t suppose you remember the steps that led up to the issue? We are trying to reproduce the issue so that we can prevent it from happening and not having much luck :frowning:

These are the notes about the process so far. Note that these notes aren’t mine, but I hope they are helpful!

Time & Date working on Project : ~8pm -1am - 2022-04-05 into 06
Project Branch/Scene Setup:

  • master scene was a copied project
  • already working in a branched scene

Artist Notes of tasks performing:
I, the artist, was working a lot with lights and modular assets setting up a scene. These are a bunch of the things I was doing and working on when I encountered this unable to delete error.> duplicating modular assets around the scene

  • Was having trouble seeing them so I decided to make some lights
  • uploaded lights to the scene

Lights

  • adding a light fix geometry (MESH)
  • adding a spot light (LIT) - parented it under the light MESH
  • created an entity (GRP) to hold both the MESH and the LIT
  • duplicating light GRPs and parented them in groups of 3
  • Did not rename any of the duplicated lights or entities at this time so there were many things named the exact same thing

Templates
I tried r-clicking and making these groups into Templates (but I admit I didn’t know exactly what this did or how to best use this feature). I was trying to make the GRP I’d made, here in play canvas, into a template light group that I could instance and change one light and it would change them all.

  • I tried adding adding an instance (lights_fig2), and adjusting the lights to see if it worked and duplicating…But It wasn’t working like I’d wanted or thought it would so I right clicked and Unlinked from template and moved on
  • I tried this template thing with a couple of groups and ended up unlinking them all
  • deleted the templates from the assets folder (the next morning)

Lights Cont.

  • moved the groups around the scene to test lighting options
  • renamed some of the spot lights to have a “- S” at the end so it was “Spot Light - S”
  • enabled shadows on those lights with the changed name
  • however it started doing weird things with more then 4 or 5 lights with shadows enabled - began blowing out my scene so I decided to turn all shadows back off and remove the “- S” from the names
  • Somewhere In all that I deleted a light group called “Lights_Set_6"
  • duplicated another light group and called it the same name “Light_Set_6”

our error was on the “Light_Set_6"
Cannot find child entity aafafe46-8576-47a8-af7f-7160e8a435a3 of parent “Lights_Set_6” (02b0c74d-c33d-4e70-a045-eefc863bf632)
(anonymous) @captureconsole.ts:73
in our cleanup merge exercise that fixed the issue it deleted the missing entity which was one of the duplicated spot lights under “Light_Set_6"> During all that I also Adjusted the lights to have different intensities and settings
some I adjusted one at a time
others I adjusted by selection all the middle spaced lights and adjusting their intensities all at the same timeAfter / during this lighting stuff I found that I couldn’t delete some of the other lights I had been using in the scene. So I tried deleting other stuff and could delete nothing from the scene.
I tried refreshing the browser with no avail.
So I made a new entity and renamed it DELETE and put all the entities I wanted to delete into that folder until I could ask the guys to help look at this issue the next day.

Other Errors Besides Deleting - also had trouble uploading fbx’s:
The next day around noon - I was also having trouble brining in new fbx’s into my Assets folders. Before fixing this delete error problem I had brought in 2 fbx’s and they both made a folder but I could not see them till I refreshed AND the folders were actually empty upon checking them.

Other thoughts:

  • we also wondered if the time of day when I was working that maybe an operation got caught between the daily rolling over
1 Like

Awesome, thanks for the info. I will try to repro the issue with it

Edit: Still can’t reproduce it at will :frowning: If anyone does find more patterns or ideas, please do let us know