If you use UE5, you might have noticed there’s a new-ish feature called Data-Driven Console Variables, and you might also have noticed that nothing comes up when you Google this. There’s not much to it, but in the interests of having something come up when you Google this, here’s what I’ve figured out about data-driven cvars.
These are just an easy way to define console commands/console variables without any code. This is super useful – just the other week, an artist wanted to constrain the camera’s aspect ratio in PIE, and I didn’t know an easy way for him to do that, so I threw in a cvar for it. Under project settings, you can just add whatever you want – this part is pretty self-explanatory:

Then all you need to do is get the DataDrivenCvars
subsystem and bind to its OnDataDrivenCvarDelegate
, and do whatever you wanted to happen when the variable changes:

Of course, you can also use the usual GetConsoleVariable
functions to get the values of your cvars from anywhere, just as you would with other cvars.
Leave a Reply