Add getControlsByType() method to AdvancedDynamicTexture

Heya, I made a little getControlsByType() method for AdvancedDynamicTexture that returns an array of controls whose typeName property matches the passed typeName parameter. It could be pretty handy to configure all of the controls of the same type with a forEach, like below for example. What do you think about including it or something like it? :slight_smile:

advancedTexture.getControlsByType("StackPanel").forEach(panel => panel.isPointerBlocker = true);

The PR just adds two functions, getControlsByType and _getControlsByKey, which are modeled after getControlByName and _getControlByKey, except that array filter is used instead of array find and they return an empty array when no matches are found instead of being nullable like getControlByName and _getControlByKey…

3 Likes

When we were close to finishing alpha, we were wondering if other shortcut helpers functions needed to be added besides getControlByName.

I am not against adding more if people think it’s useful and will save them the headache. Just double making sure we are not over bloating with dozens of these functions. I think getControlByType makes sense…I can see it getting used more frequently. So I guess let’s add it in.

(Future reference for @Blake feel free to continue the GUI editor thread even for feature requests and bugs)

2 Likes