Download

How does the "Get all widgets of class" node sort the items it finds?

When you use the “Get all widgets of class” node, how does it sort the items it finds? I am working on a system that I want to be able to reuse that relies on this node, but in order to be able to do that I need to be able to predict/control how it sorts those items into the Array that it returns.

I have tested it across two projects by now, the widgets it was set to find were simply named with a one digit number(1,2,3,4,5).

In the editor, all relevent widgets are children to a horizontal box, the manager that calls the node is at the top of the hierarchy while the widgets it is looking for are below it and are numerically ordered, so in both projects they are ordered : Manager, 1 ,2, 3, 4, 5.

The thing is that one project always returns them as 1, 2, 3, 4, 5, while the others always returns them as 5 ,4, 3 ,2 , 1 and that is what confuses me. It seems that there is something that tells it to either work its way through the hieararchy top to bottom or bottom to top, but I just cant figure out what that is or if it is just random.

Does anyone know what criteria the node uses to sort them or why it might sort them differently?

I believe the function is similar to Get All Actors of Class, in that you can’t rely on it for getting a sorted array in any consistent manner. Any sorting you do would have to be done manually with the result it provides.