Greetings! Sorry to bother you with my problem once again! In order to do certain tasks that could not be handled by ORK directly, I have coded a couple of functions to complement those provided by the plugin itself. One thing that have been giving me a headache, though, is how to instantiate and refer the newly created HUD to a certain combatant via code. Basically, I want to create a new instance of a HUD inside a game object (another HUD), and link this new HUD to a specific combatant so it can get data provided to it (such as combatant name, max and remaining HP, the usual stuff). Is it even possible to instantiate a HUD via code like this? Thank you for your time and consideration!
E.g. try using a HUD Combatant Object (Content Provider) component on your HUD prefab and set the combatant's game object as it's user after spawning the prefab.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Ive searched in the source code where the HUDs are created and its content set because I trying to find a way to instantiate a HUD and bind an equipment (or item) to it via code.
Edit - btw, why the schematic node Call HUD often do nothing? What requirements must be met for a HUD to be displayed via Call HUD?
You can get/create an instance via:
HUDInstance instance = Maki.UI.GetHUD(hudAsset);
hudAsset is a HUDAsset class (i.e. the actual asset of the HUD).
Needs the GamingIsLove.Makinom.UI namespace.
With that, you can set the user of the HUD:
instance.ChangeUsers(user, ListChangeType.Set);
Beside the display conditions of the HUD, some HUDs are also bound to specific states, e.g. the Turn Order HUD can only be displayed during turn based battles, or the Tooltip HUD only when a tooltip is available, etc.
The main use of the Call HUD node is for Information HUDs
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Is it possible to instantiate an instance under a parent (or change it, after creation)? Or to put it another way: How can I get the *GameObject* or *Rect Transform* from that? Ah okay, thank you. I wasnt sure which type of HUDs to use in general. (Except for the obvious ones of course :))
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!