x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Setting Custom Console Variables from Command Line

Hey All!

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.

Thanks for any help!

Branden

Product Version: UE 4.8
Tags:
more ▼

asked Aug 25 '15 at 11:12 PM in Using UE4

avatar image

trandenburner
6 1 1 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

To directly answer your question, the docs are here 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:

 UFUNCTION(Exec)
 void HelloComputer(FString value)
 {
     UE_LOG(LogTemp, Warning, TEXT("Generating Plans for %s"), *value);
 }

Then when you type in the console HelloComputer Transparent Aluminum you get something like this:

alt text

more ▼

answered Nov 18 '15 at 06:28 AM

avatar image

smilingrob
580 19 31 49

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question