I believe you are thinking along the right lines with static members, but I am unsure on the specifics of how to implement something like this. Ideally, you’d end up with something like YourClassName::Name to access your static member.
Sorry I can’t be of more help, try Googling as I’m sure this is a common thing to do
What I’m trying to do: I have a building class blueprint, that can produce various goods. The building has an array of classes, specifying which goods it can possibly produce. I want the player to select the product that the building is producing. The building is then spawning actors, deriving from the product class. For the player to be able to select a product, I offer a list with all available options. Each product has a “name” attribute, specified in its class blueprint. Now I want to read the names of all classes specified in the building’s array and display them in a window.
However, as I understood it is just not possible to access a variable’s default value from a class. Why is that? I don’t want to spawn an actor of that class, just to read its name and then destroy it again. The only other option I can think of is to create a struct, storing the class and its name and put these in an array, but that means storing each product’s name twice, which is rather messy, too.
Is there some option I missed? Is there a way to read a default value of a class variable? From my programming background that seems to be a pretty common thing, talking of static class attributes.
this leads me to believe that we need to (as a crappy workaround) spawn a new object of the class and reference its base stats. i plan on having one instance of the object held by reference in the gamemode, then refer to it throughout the game.
this will work for me, not sure if that will work for you.