How to disable a UI

I have that code to enable the UI:

var BP=‘SwitchingMaterialsUI’);

    if ( == 'Table' || == 'Pointer1'){
        localStorage.setItem('entityclick', 'Table');
        BP.enabled = true;

And that code to disble when I press a button of the UI:

 var BP='SwitchingMaterialsUI');
 BP.enabled = false;

If I check the state of BP.enabled, it is false, but the UI don’t disappear.

You have not provided a link to exact replication of issue.

If your UI is DOM elements, then you have to hide/show them on event enable/disable of a script.
DOM elements don’t know about entities states, etc.

I don’t know if my UI is a DOM element.
That is my project.

Basically, DOM - is HTML elements. And yes, your UI is DOM elements, so you have to hide them when script is enabled/disabled.

Yes, ok, but y write entity.enable = false;
But dont hide. :frowning:

It will only disable entity, as DOM elements are independent and separate from entities. Regardless of where JS code is written, there is no relationship of states between DOM and Entities - you have to simply subscribe to enable/disable events on script of that entity, and set style.display = 'none' on DOM elements you want to hide. Or some style class alterations on some parent DOM element and handle display: none in CSS.

1 Like

@max so now that I have

Uimanager.attributes.add(‘menu’, {

Uimanager.prototype.onMenuBtnPressed = function (event)
// how to access the style of the entity / element I have ?
// = ‘none’ ? since such a thing doesn’t exist

thanks in advance

@christian_ti check it here:
Enable / Disable UI elements