I want to know how to clear the child elements in the grid, because the name is needed to clear, I want to directly clear all the child elements in a grid, which master can help me
Hiya IP.
https://www.babylonjs-playground.com/#KX33X8#141
Check-out lines 248-252… should do the trick. It dispose()'s all grid-kids after 5-secs.
You can also use grid.getDescendants() to gather a pile of all controls (and their kids)… and munge-thru the pile to change names/text/whatever… (without dispose/re-stock).
Notice that getDescendants() has some powerful user-settable parameters/options. (If that link isn’t accurate, scroll-around in that doc a bit… you’ll find getDescendants)
Party on, hope I was helpful.
Shouldn’t this be it?
for (const child of parentNode.getChildren()) {
child.parent = null
}
Or am I missing something? (With Babylon it is easy to miss something non-obvious.)
The topic is about GUI Grid
and your code uses functions of TransformNode
Hi,
Could I ask you to kindly open a new topic for your question?
This one is 3+ years old and should have been marked as solved. cc @carolhmj (may be you could do that?)
As per @Takemura 's answer, the solution will depend on your use case/architecture.
Sidenote:
I use to call this ‘Versatility’ and I believe is one of the greatest advantages of BJS
Of course, as always, my opinion only and… meanwhile, have a great day