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"

Execute Console Command not working in Construction Script

Hello everyone, thanks for your attention.

I am currently writing a blueprint only graphic settings menu (hopefully to be submitted to the marketplace in a few days) in which I would like to be able to execute console commands in the constructor graph which doesn't seem to work.

The reasoning is that I want to give an option that lets people tweak their graphic settings inside of the editor and assign them to certain save files just like my menu currently allows for in PIE in case they wanted different settings for different scenes while working on their levels. This will not only help people with graphics profiling but also give more control over graphics settings inside of the editor than the engine scalability settings allow for.

My analysis is that, since command lines are routed through player controllers (even if a certain reference is not specified) executing them in a construction script doesn't work since the constructor script fails to find the necessary controller reference given that a player doesn't exist in the construction phase inside the editor. However I keep thinking that there should be a workaround for it since it is basically the same thing as actually writing the commands in the console when in the editor. Maybe I'm overseeing something very simple here, such as a reference to plug to the execute node's "specific player" pin.

To sum up I would like to find a way of executing console commands in construction scripts if it can be done; and if it can't be done I would like to be sure so I try implementing the same functionality by other means.

You can check this behavior easily by creating an actor blueprint, assigning an "execute console command" node to its construction script, entering in a command line (naturally I'm working with the r. commands but any other won't work either), dropping this actor in your level and doing anything that fires its constructor such as moving it around. This is present in both 4.6.1 and 4.7 preview. Sorry for the long wall of text, wanted to be specific : ) Thanks in advance !

Kerem Horzum

Product Version: Not Selected
more ▼

asked Jan 19 '15 at 03:16 PM in Blueprint Scripting

avatar image

11 1 2 5

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

1 answer: sort voted first

Hi k.alpha,

I don't believe the construction script of an object would be the best place to implement this feature. A construction script is only updated on move, rotate, and scale while in the editor, not during play. The only time it fires during play is when the object is spawned in. Both of these methods are working correctly in 4.6.1 & 4.7.0.

To test this:

  • Set the blueprint to execute a 'Stat FPS' console command.

  • Don't place it in the level, spawn it through your character blueprint.

  • With each spawn during play the Stats will toggle.

I suggest creating this functionality in a level, widget, or game mode blueprint.



more ▼

answered Jan 20 '15 at 09:34 PM

avatar image

41k 1009 183 494

avatar image k.alpha Jan 20 '15 at 11:42 PM

Hey TJ,

Thank you for answering, correct as your answer is it doesn't exactly help my case so allow me to rephrase : Is there a way I can issue console commands using blueprints while inside of the editor and NOT in a play session ? I have all my menu functionality currently working in play already, I am looking for a way to allow execution of console commands inside of the editor while designing levels since I believe it would help level designers and people without the required console commands knowladge; as an addition to the already existing quick scalability settings.

To give a basic example I want the following bit to work properly that makes use of a public "Toggle FPS" bool that functions as a button, following your stat fps command mention : alt text You'll see that after placing this actor in your level, choosing its instance for debugging, selecting it from the scene outliner and "pressing" the public bool in the details tab of this actor the execution pin is correctly fed yet the node doesn't function.

I believe there should be a way of making it work since what I want is simply the same as manually entering a command line in the console. I'm thinking the problem lies within the way blueprints route the "execute console command" node which is through a player controller since there isn't a player present in the editor. Let me know what you think, thanks for your time : )

Kerem Horzum

avatar image TJ V ♦♦ STAFF Jan 21 '15 at 03:25 PM

I see what you mean now, I'm sorry I misunderstood. The in-editor console commands aren't executable in this way. The 'Execute Console Command' node will only work with the 'in-game' console commands during play.

What you are essentially trying to do is extend the editor. Which is something that we encourage, but at the moment however the only way to do this is through C++ via plugins. We recently had a Twitch stream on just this functionality.


We had an experimental feature early on that would allow users to build editor tools through blueprints but it it was taken out of the editor just after beta because it wasn't working as intended. This is something that our devs would like to see make it into the editor again, eventually.

avatar image k.alpha Jan 21 '15 at 05:07 PM

No problem at all : ) I could have better explained myself since my initial idea was implementing plugin functionality with Blueprints like you've said.

What you are essentially trying to do is extend the editor.

-Exactly ! I wanted to try this without c++ so people sticking only to Blueprints would be able to tweak them as well. It would definitely be a handy feature and I'm sure the brilliant dev team over at Epic will find a way for it eventually, thanks for the info. This resolves my question, I needed to know for sure that it couldn't be done. I will submit my content without such a feature then and start writing a plugin for it (thank you for the stream as well, I hadn't come across it before and it certainly is a usefull one) . Keep up the good work ! Kerem Horzum
avatar image ZkarmaKun Feb 24 '17 at 08:42 PM

Hi k.alpha I wanted the same, and after a little research I found you can call it from GEditor: #if WITH_EDITOR UWorld* World = GEditor->GetEditorWorldContext().World(); if (World) { GEditor->Exec(World, *Cmd, *GLog); } #endif

you'll need include UnrealEd.h, I made my own inside a Blueprint function library class

(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