Entity lifecycle

After enable entity (disabled on load) initialize work immediately or in next frame?
Same with clone entity?

Hi @KpoKec,

Yes, from the moment the entity is enabled and added to hierarchy its components will be enabled and get activated (scripts will execute).

But cloning not added to hierarchy.
By example, I have disabled entity, clone it, reparent, enable - than I can immediately fire events?

I think so yes, one thing you can do verify this is use the browser debugger and add a breakpoint at your entity enable line.

From there you can step in your code and see exactly in the what order things happen.

“Check this manually” ))

Sorry I didn’t get what you mean.

In your code I don’t see anywhere any entity getting cloned, the element margin is a pc.Vec4.

I mean, documentation is not detailed this, need manually check this things. Unity Docs little bit better.

1 Like

It’s a good feature request for the docs, to have an entity’s lifecycle explained.