Best place to put global structs?

Hi, I’ve got a selection of structs I keep using over and over again in different classes. Is there a best practice of where to put them? I’m thinking a class based of BlueprintFunctionLibrary or something?

Thanks for any help.

You can create an empty class and create your structs and/or enums and/or static functions there. But you have to #include it to any class you want to use it in.

Does this class need to be derived from a UObject class or anything? Do I need to do anything special to it so it gets picked up by the garbage collector?

Wait, you meant global structs so that you have structs with certain values accessible from everywhere? Then it must be a UObject, afaic.

I got confused by your mentioning BlueprintFunctionLibrary; because those are static functions that can be called from anywhere but do not store any global values.

Depending on your project structure, you can store global structs in Game Instance of Game Mode.

1 Like

Thank you, that seems like the best approach.