[SOLVED] Manage entities obtained by a "findBy" function

Hi everyone,

I am trying to enable/disable entities obtained by a findByName or Tag function, but i do not understand what i am really obtaining.
At first i though it was an array with all the objets, but after doing console.log it seems to me that only takes an object and not all with that tag or name.
Tha documentation says it only takes the first node, so i do not know how to obtain every object with that name or tag

Tha code i tried is the folllowing:

var oldButtonArray = this.app.root.findByName('oldUIButtons');

    for (var i = 0; i < oldButtonArray.length; i++) {
        oldButtonArray[i].enabled = true;

i am sure it has a simple solution but can not find what will be

Hi @practicas_imas! With findByName you only get the first result. If you use findByTag you get an array. So I suggest to use findByTag here.


You can also use find with your own validation method as a way to get all entities named like this:

var oldButtonArray = this.app.root.find(o => o.name === 'oldUIButtons');

Thank you both!