Instantiate issue cant add in some entity as a child

Hi @yaustar @Albertos
please check this issue its not working in both cases

Hi @Ayesha_Irfan and welcome,

You can’t reparent an entity that doesn’t have an existing parent. Use addChild instead:

this.tempEntity.addChild(clonedEntity);

it is not working as well. Tried both of them

@yaustar @Albertos @Leonidas please tell any alternative solution

These are the solutions.
What is not working for you?

The entity is instantiated but is not added as a child in tempEntity. The tempEntity has no children

I’d put a breakpoint on the line to see what happens. Perhaps post a screenshots of that too. It should most definitely work, if the clonedEntity is not null / undefined.

2 Likes