1st change: parameter pack
The RecurseObject function currently has four variants, that is four times the code necessary and that only works for four variants, whereas a variadic template works with arbitrary arguments.
2nd change: move to other file
Aside from using parameter pack, the function is also located in GUIutil.h, which is unfortunate, because that file should only contain setting management, but this one is also used for event broadcasting or draw calls.
The function calls a given IGUIObject function on a given IGUIObject and it's children, so it makes more sense to have it in IGUIObject than a historic miscellaneous helper-functions file.
3rd change: CheckRestriction as an argument
The third change in this patch is that the CheckRestriction function and GUIRR enum are superseded with another function pointer to an IGUIObject member.
This way it is cleaner, because the hardcoding is removed, and it is more extensible because IGUIObject inheriting classes can define and pass custom functions.
4th change: drop unused Disabled check
- The "Disabled" restriction was removed because unused and easily addable for hypothetical users.
5th change: don't iterate base object
There is a TODO in the code asking to not have the base object iterated. Instead of copy&pasting the TODO, it can be deleted or implemented.