Enums and Structs - how to use those?

Hi, I’m tryingt create system where loot item has material tinted based on rarity (comon, rare, epic…), and i have struct with color for each type.

My Master_Item has variable referencing struct file where i have color for each type (of rarity).
In enums, i can pick variable from dropdown list and go from there. Is there something similar for struct?

How can i setup system where if select one type of rarity, associated color value is selected and applied to something?
I looking for general example how to use struct and access its variables, not specifics on applying materials to objects or anything similar.

I tried to use it in tandem with enum where rarity types are coming from enum file and color values are coming from struct, but i think that is quite stupid way to get it done.
Can someone provide me with guidance?
Thanks, H

What you could do is whenever you want to add the tint, get the enum variable and drag off the output, when the box appears where you can type to get a new node type “switch on” and you should see your enum.

When that node comes up you will see different execute pins for each possible result. On each pin you can set a color variable to what you want. If you don’t need to set the rarity dynamically, you could do this in the construction script and use inheritance to make sure all of your pickups do this operation. :slight_smile:


Sorry for double post, but editing posts is broken on mobile. :confused:

You don’t really need a struct unless you want to carry more than one variable. Since you only have the color of the tint, you could get away with just a color variable.

thanks! ill do my best to follow on your advice. Much appreciated!