devis Posted September 20, 2018 Share Posted September 20, 2018 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? Quote Link to comment Share on other sites More sharing options...
Guest Posted September 20, 2018 Share Posted September 20, 2018 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 Quote Link to comment Share on other sites More sharing options...
devis Posted September 20, 2018 Author Share Posted September 20, 2018 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? Quote Link to comment Share on other sites More sharing options...
Guest Posted September 21, 2018 Share Posted September 21, 2018 I would recommend something along these lines: adt.executeOnAllControls(function(control) { if (control.linkedMesh === mesh) { ... } }) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.