rantrod
(rantrod)
January 16, 2016, 12:07am
1
I’m working off of source. Not sure where I would put the C++ code to do this. Ideally in my project code rather than the base engine (so ideally not in UEngine::Exec).
Note: I know about UFUNCTIONS but those are for in-game. I’m looking to put an in-editor command.
rantrod
(rantrod)
January 16, 2016, 4:59am
2
I created my own editor engine derived from unreal’s, with the EXEC function that parses console commands:
UCLASS()
class UMyProjEdEngine : public UUnrealEdEngine
{
GENERATED_UCLASS_BODY()
virtual bool Exec(UWorld* InWorld, const TCHAR* Cmd, FOutputDevice& Ar = *GLog) override;
};
Then in the cpp file I call my custom console command and make sure to call the super:
bool UMyProjEdEngine::Exec(UWorld* InWorld, const TCHAR* Cmd, FOutputDevice& Ar)
{
if (FParse::Command(&Cmd, TEXT("MyCUSTOMCOMMAND"))) {...}
return Super::Exec(InWorld, Cmd, Ar);
}
Then in my projects DefaultEngine.ini:
[/Script/Engine.Engine]
UnrealEdEngine=/Script/MyProjEditorModule.MyProjEdEngine
1 Like
Thanks for this, mate, it was very helpful to me