How to create and get custom console variables in blueprint?

It’s very important for our development. Thanks!

in C++, use UFUNCTION(Exec)

Also these links may also be helpful:

Thank you! I know how to do it in C++. But I want to do it in blueprint. Do you know how to do that?

Oh ok, then if the console command is already setup you can call it from a BP using this node:

128092-executeconsolecommand.png

Thank you again:) And do you know if there’s no existing variable named VarA in the console, how can I create one in the blueprint and get its value?

Not that I know of (VarA)…to create a variable in BPs just click on the + symbol in the My Blueprint tab and that will create a new variable, from there you can edit the variable type in the Details tab by using the drop menu. To read or get the values from the variable just connect it to the corresponding nodes that need the value from it. So if it is a console command it should be of String type and then using the node from above you connect the pins from the string variable to the Execute Console Command node’s Command pin. The variables value would be the string input for the console command.

Sorry, perhaps you didn’t get what I meant. I want to create a console variable in blueprint, and when I click “`” button, in the console bar I can find the variable I create. So, I want the way to do that:)
As follows

128093-微信截图_20170228150759.png

1 Like

Oh ok, I see now, I don’t think that is possible at the moment with only blueprints and console commands. However you can create custom events in your level BP and call them from the console using “ce MyCustomEvent1” or whatever you want to call it…like this:

128094-customeventfromconsole.png

Thanks!! I think there’s little possibility either. And you gave me another good and workable idea~~