How do you create and use a default custom config file for a plugin?

Hi all, my first posted question so forgive me if I omit any contextual details that might make answering easier.

I’ve created a plugin that includes an actor component with a bunch of default settings. The default values for these settings are all stored in a custom config file that I want to be loaded whenever someone adds this component to an actor.

I’ve had some success populating a config file and having the component load the values from it, but for some reason I could only get this to work if I used the Saved/Config/Windows directory. The UE4 plugin documentation says to create your default config files for the plugin in Plugins/PluginName/Config with the ‘Default’ prefix on the name of the file but any files created there seem to just be completely ignored.

I also now have a problem with the editor erasing my config files in Saved/Config/Windows whenever it loads my project. I’m not sure if that’s intended behavior or not… The only call I ever make to do anything with the configs is a LoadConfig call in the constructor of my actor component. There’s no call to save anything to the file so I wouldn’t expect it to modify them.

As an alternative I’ve also considered manually accessing the config file I want. The values I need to load include a set of TMap types, however, and whilst the config system seems able to store and load these fine automatically I can’t find any manual calls to retrieve TMap data types from the file. How would I load a TMap from config if I accessed the file manually?

I imagine I’m misunderstanding how the config system works somewhere so any help would be greatly appreciated. Thanks.

1 Like