Hey guys.
Lemme start right off with my situation:
I have a class “base_buildable” in my game that contains the variable “image_icon”. I have two children blueprints of this class: “wall_a” and “turret_meele” that both have a defined default valuefor image_icon (Paper 2D Sprites).
My idea was that every child of base_buildable has its own icon that I can define in the editor. Really, this is a constant for the specific entity and these variables are defined as read-only.
Now I want the following code to be “future proof”, so apathic to the types of children that exist at this point. So within my hero character blueprint I have a class reference array of base_buildable that contains the in-play buildables (as I do not want all to be in play at all times). I’ve defined this array as a class reference. This array contains the chosen buildables, up to 8 of them in a certain order.
Now, within my UMG HUD I have 8 images defined and want to bind the images to the default content (i.e. as defined in the editor) of image_icon for the base_buildable children (which are wall_a and turret_meele).
Think of it as selecting buildables from a long list and having the chosen ones displayed in images. The selection should be separate for every player.
So to sum it up:
- base_buildable has a variable image_icon defined
- Children blueprints wall_a and turret_meele have different default values for image_icon
- Player character blueprint has a class reference array to base_buildable, contains turret_meele and wall_a
- Within HUD, I want to access the default variable content of image_icon of turret_meele and wall_a, but can only access base_buildable default variable content.
- I want to avoid trying to cast to every single type of base_buildable child in the game to access its default variable, as I want the HUD “script” to just work regardless of how many more buildables I add.
How do I access this default variable content the smartest way?
Hope it’s clear what I mean.
Thanks for reading! I appreciate any suggestions and ideas.