Jump to content

How do you dispose controls linked with mesh


Recommended Posts

When I dispose a mesh, the control which I have previously attached to the mesh remains.

I assume I need to dispose of the controls that are associated to it. For example name tags that follow around a mesh.

Is this the intended behavior?

Is there a reference from the mesh object to attached controls? 


Link to comment
Share on other sites

Yes this is correct. You have to keep track of the attached controls

But if you decide to dispose a mesh, you can go through your control list and check which ones are attched to the mesh

Link to comment
Share on other sites

Actually this is quite odd.

The control is removed from the Container's _linkedControls array ( BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI ) when the mesh is disposed.

I'm manually removing the control now via iterating through the rootContainer of the Container object

._rootContainer.children[x]._linkedMesh === null

Is this the best method?


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...