Download

Proper way to implement custom settings

I have an Enum where each element is a type of spell with a different behaviour.
The enum is enough to be passed around ( CastSpell(enum_spelltype) works great ).

The problem is that I have a list of common properties for each Enum_spelltype that I would rappresent like this:

enum_spelltype | Name | Description | Cost | etc…

Atm I just have multiple methods like GetName, GetDescription, GetCost, … which accept an Enum as input, then switch on the enum and return different results.
so instead of having an excel file I do have gigantic switch with hundreds of return value.

Can you suggest a better way to achieve the same results?

Create struct, make data table from a struct.
My struct looks like that array “ability gameplay stats” its actually another struct with enum + value
You can add them directly to the datatable struct, but i like to have proper names for everything and dont do notes about damage is actually heal per tick, i have function which go over array of gameplay stats and find one which i need.

also, function to get row looks like that

I love this!

btw do you have anything similar to also store user-preference? I mean, do you have an implementation of some form of persistance of preference data already in place?

I dont understand a question, what is “user preference”?
there are “data table” asset type under miscellaneous http://puu.sh/ljW89.png

Player will have a certain degree of customization, so I need them to be able to save a structure similar to that one but that persist on the player computer.
(it should be able to save and load those settings from a file)

there are save game files Saving and Loading Your Game | Unreal Engine Documentation

Thanks, that is what I was looking for