engine icon indicating copy to clipboard operation
engine copied to clipboard

Engine generated graph nodes in entities (eg elements) causing issues with children length

Open yaustar opened this issue 3 years ago • 2 comments

Related to: https://github.com/playcanvas/engine/issues/1660

A user had an issue where some logic was dependent on the number of children that an element entity had.

Because a graph node is created by the engine for the mesh, the count was always off by one and took some time to work out that there was an extra graphnode that's not shown in the Editor but was created at runtime.

The proposal here is that we have a new API that only has the children that are entities unless anyone has other ideas to tackle this.

yaustar avatar Jun 16 '22 12:06 yaustar

Just came across this code just now: Screenshot 2022-07-13 at 13 21 04

It uses render component to render UI, as it should .. but now we can remove the GraphNode it creates, and the render component would connect to the entity directly, instead of the graph node.

Would need testing, but should work. Other element components would need to be updated as well.

mvaligursky avatar Jul 13 '22 12:07 mvaligursky

actually, after another look I realised this still internally uses a model component, and probably should be converted to a render component as well.

mvaligursky avatar Jul 13 '22 12:07 mvaligursky

The proposal here is that we have a new API that only has the children that are entities unless anyone has other ideas to tackle this.

The better plan is to remove the use of the model / model component internally in the engine, which is what creates those extra nodes, and convert it all to use the render component, which uses the entity itself instead of an extra node.

mvaligursky avatar Sep 26 '23 16:09 mvaligursky