Hi there - I'm using ORK 2.33 and I'm really enjoying all it has to offer. I was wondering if you could help me with one problem I've been wrestling with though. I'm using the 'New GUI' option and have a menu that I'm trying to populate with custom button entries when the menu is opened. I love having ORK managing menus for me so I'm keen to integrate as much as possible!
My first thought was that this might be doable via Events. I can of course run an event with a 'Function to Variable' node when the menu is opened, which I'm using to good effect in other areas. As this is for simple data types though, I'm not sure this is appropriate here. I also couldn't find a way to pipe content out to update a menu's button list via an event. Is there something I'm missing in the UI events that I could use for this?
Alternatively, I've tried a different approach, where I've used a custom GUI Box prefab for the menu screen in question, which holds a setup script. This is successfully being executed when the menu is opened or re-enabled.
From the setup script, I can grab references to the GUIBoxComponent of the menu and the ScrollRect housing its content. I can add my buttons by instantiating prefabs, setting up their details and adding them as children of the menu's ScrollRect content. This does add the buttons to the correct menu positions, but they're essentially inactive and the ORK menu has no idea they're there, so there's no navigation controls or scrollbar added.
I've tried a whole slew of options, broadly involving combinations of the following steps:
- Creating my button object and doing it's initial onclick setup and positioning
- Adding a UIPoolComponent to it and setting its prefab
- Adding a GUIContent to it and setting its texture, then creating a ChoiceContent from that
- Adding a UIClickComponent to it
- Adding a UIChoiceButtonComponent to it and initializing it using the GUIBox, ChoiceContent, Prefab button etc... (though not quite sure what to use for the NewUIButtonSettings and NewUIChoiceButtonEvents here)
- Running UpdateBox/UpdateColors/ToPoolRecalculate against the GUIBoxComponent / settings its 'ContentUpdated' flag to true
Each of these elements looks to be involved, but I've not cracked it yet. I'm essentially black boxing for testing the results which is what has prompted me to make a post and see if I can get a steer on this. Am I anywhere close with any of the above or is this an inappropriate way to go about this?
I've read pretty much everything related that I could find on the forums and understand that what I likely need to do is implement the IChoice interface somewhere to handle controls on the menu. I was hoping to avoid this by piping buttons into an existing menu rather than implementing a new menu type, but would this be the best way to go?
From digging around the source code, I notice that it is the menu parts (e.g. ButtonListMenuPart) that implement IChoice. Am I right in thinking that I could use one of these as a template to build my own menu part and have this initialize the menu with all of its required content, perhaps in its Show method? If I were to do this, would there be a way to add my custom menu part to the list of menu parts in the ORK Editor, or would I need to try and find a way to set it up and switch it in at runtime?
Anyway, I'm hoping I've outlined my plight sufficiently there. Apologies for the lengthy and fiddly question(s), but I'd really appreciate any assistance, examples or pointers you can give me. If I can crack this then I can think of an absolute ton of uses for it. Thanks for your time!