I Cant quite work out how to make this work correctly. I feel like Im missing a system or node or maybe an understanding.
Essentially I only want to show certain widgets on certain Int Switches, and when the “Area choice” Is changed the widgets disappear/change to the next areas widgets.
I could Have visability on all widgets and target them every int change but eventually thats going to be an absolute mess of nodes and make me feel sick to look at.
I was going to do them as children that appeared but itd still require removing from parents each time which is equally faffy, it was also nightmare that barely functioned with my time/day system. Im tempted to retry it, maybe I missed something.
Gosh dang it. I just dunno, I keep staring at it hoping something will come to mind, But I think its just a hole in my knowledge.
Hey @Skyboy! No worries, this is a job for Arrays!
You’ll create an array for each of these outputs, such as Area 0 Array, Area 1 array, and so on. Next, you’ll make an array that has all of the array contents together. Then out of each output, you’ll do a ForEach loop using the All areas array with the output being Set Visibility -false and then another forEach loop with exclusively your Area 0, 1, 2, or 3 array with the output being Set Visibility -true
After setup, each output from your SwitchOnInt Should be 4 nodes total
this is good for small menus where manually setting up your widgets into arrays is no problem.
If you have a ton of widgets or maybe you want to just hand off system to somebody else who will use it but not care about the code, what you can do is derive your widgets from a custom class and then you can get all the widgets of that class to put them into the array from code.
To get reference to widgets you need them to be in a container, like a horizontal/vertical box, or overlay, or canvas panel, etc. You get the container > get children > cast to your class > and that gives you the widgets of specific class.