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"

Custom registered Console Commands dont work in PIE

Dear Friends at Epic,

Here's what I've done that works!

  1. Register new console commands in PlayerController post being play

  2. override GameEngine to respond to custom console commands (UGameEngine::Exec( UWorld* InWorld, const TCHAR* Cmd, FOutputDevice& Ar ))

  3. Edit config file to use custom game engine

  4. call console commands in-game, they work!

    Related Working Code

    ;~~~ Game Engine ~~~ [/Script/Engine.Engine] GameEngine=/Script/Solus.SolusEngine

    PIE Doesnt Work With Game Engine

First of all, PIE doesn't work with my above setup, but it really should shouldn't it? PIE is supposed to simulate commandline game! And Hourences only wants to work in Editor PIE, not from commandline like I do.

So I need to get him access to the console commands somehow!

They work great in commandline version of the game!

What I tried

I tried overriding Unreal Ed Engine, assuming that PIE would use that

I added consolec ommands in Engine Init, and overrode the Exec

UUnrealEdEngine::Exec( UWorld* InWorld, const TCHAR* Cmd, FOutputDevice& Ar )

PIE did not recognize the new console commands!

Then I added the console commands via BP node, and now they show up in PIE and I can TAB auto complete

but when I run them,

PIE still can't find them!

So what version of the

Exec( UWorld* InWorld, const TCHAR* Cmd, FOutputDevice& Ar )

Is PIE using?!

I overrode both UGameEngine and UUnrealEdEngine and neither one worked in PIE!

Let me know!

Thanks!

Rama

More Code For Reference

I am receiving custom console commands successfully by overrideing GameEngine::Exec and using custom game engine in config file:

 /*
 
     By Rama
 
 */
 #pragma once
 
 #include "SolusEngine.generated.h"
 
 UCLASS()
 class USolusEngine : public UGameEngine
 {
     GENERATED_UCLASS_BODY()
 
     /** Called at shutdown, just before the exit purge.     */
     //virtual void PreExit();
     
     //Exec
     virtual bool Exec( UWorld* InWorld, const TCHAR* Cmd, FOutputDevice& Out=*GLog ) override;
     
 };

CPP

 bool USolusEngine::Exec( UWorld* InWorld, const TCHAR* Cmd, FOutputDevice& Ar )
 {
     bool Claimed = Super::Exec(InWorld,Cmd,Ar);
     //~~~~~~~~~~~~~~~~
     
     if (Claimed) 
     {
         return true;
     }
     
     //custom console command
     if( FParse::Command(&Cmd,TEXT("solrs")) )                    
     {
         SCC_solrs();
         return true;
     }
 
     
     //Not captured
     return false;
 }
Product Version: Not Selected
Tags:
more ▼

asked Aug 19 '14 at 10:02 AM in Bug Reports

avatar image

Rama
10.6k 446 346 1088

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

3 answers: sort voted first

You probably don't want to be overriding the Exec function directly on UEngine, since (as you say) there is a different engine in the editor and standalone game.

You can mark any function as being an 'exec' function using UFUNCTION markup from your game mode (and any other class), and you will be able to execute it by typing that function name into the console. Here's an example from CheatManager.h:

 /** Return to walking movement mode from Fly or Ghost cheat. */
 UFUNCTION(exec)
 virtual void Walk();
more ▼

answered Aug 19 '14 at 11:42 AM

avatar image

Ben Marsh STAFF
778 24 9 18

avatar image Rama Aug 19 '14 at 12:03 PM

Thank you so much Ben!

Rama

avatar image Urquan Aug 23 '14 at 07:40 PM

Hi

Can you assist with how you got your exec function recognized?

I get the error "Command not recognized" in the log, whether in editor or packaged game.

I have tried functions in CheatManager as well as GameMode. I have them defined with UFUNCTION(exec) too.

Something strange may be going on.

EDIT After posting the above, I realized that the CheatManager is only valid on the server. I was attempting the commands from a client. I moved the functions directly into PlayerController and all is well now.

avatar image Rama Aug 24 '14 at 09:30 PM

Glad you got it working!

Rama

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

Hey I used the solus tutorial. i get the autocomplete on the console but executing the command doesnt seem to work :/. im working with a blueprint project and i just added the code to a actor and then extended it with blueprint. but i doesnt work so do i have to use the playercontroller class in the c++ class and add the code to it?

more ▼

answered May 01 '18 at 11:16 AM

avatar image

SupDeity
468 4 7 15

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

I Got it working as well :) Thanks rama for ur wiki on custom commands. however i cant get ur configuration wiki working on my project :./

more ▼

answered May 06 '18 at 09:19 AM

avatar image

SupDeity
468 4 7 15

(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