So I’m wondering if there’s a way to do this that’s simpler than my current method. Let’s say I have two machines that are running from the same install of UE4 ( let’s assume it’s on a shared network drive that both have access to ). What I want to be able to do, is pass a command line argument to each instance when I start them to set a specific console variable to a value that’s different per machine.
As a contrived example, let’s say the variable is “r.ControllerType” and on one machine I want “Xbox360” and on the other I want “PS4”. I know what I COULD do, is create two custom ini files for each machine and use a command line to load those custom ini files instead of the normal ones, or I could have a custom c++ function that can be used as a command line minus command to set the data.
I was hoping there’s a simpler way to set these console variables, that could hopefully be as simple as adding “r.ControllerType=“Type”” or something along those lines. I want to avoid editing INI files as much as humanly possible, and I’d also like to avoid writing custom c++ code to allow this type of workflow for every new console variable I create.
To directly answer your question, the [docs are here][1] for adding your own variable like this:
static TAutoConsoleVariable<int32> CVarRefractionQuality(
TEXT("r.RefractionQuality"),
2,
TEXT("Defines the distortion/refraction quality, adjust for quality or performance.\n")
TEXT("<=0: off (fastest)\n")
TEXT(" 1: low quality (not yet implemented)\n")
TEXT(" 2: normal quality (default)\n")
TEXT(" 3: high quality (e.g. color fringe, not yet implemented)"),
ECVF_Scalability | ECVF_RenderThreadSafe);
But then you’d have to register for changes, or poll the variable. You could make a console function instead of a variable. There are a few classes where an Exec function works, but I like the PlayerController because it’s likely that you have your own custom one, and it looks like you’re doing something with input.
Inside your PlayerController add a function like this: