UEditorEngine vs UUnrealEdEngine

What is the difference between these? If I need to implement my own game editor class, should I derive from UEditorEngine or from UUnrealEdEngine?

Thanks!

Robert.

Probably UUnrealEdEngine.

When FEngineLoop::Init runs, it looks for a subclass of UUnrealEdEngine:

FString UnrealEdEngineClassName;
GConfig->GetString(TEXT("/Script/Engine.Engine"), TEXT("UnrealEdEngine"), UnrealEdEngineClassName, GEngineIni);
EngineClass = StaticLoadClass(UUnrealEdEngine::StaticClass(), nullptr, *UnrealEdEngineClassName);

Notice the UUnrealEdEngine::StaticClass(). If you try to use a sub-class of UUnrealEngine, the call to StaticLoadClass will return nullptr.

Just an addition for anyone who ever wondered what is the difference between the EditorEngine and the UnrealEdEngine:

The EditorEngine is created when running editor commandlets.

Here’s the code from FEngineLoop::PreInit:

FString EditorEngineClassName;
GConfig->GetString(TEXT("/Script/Engine.Engine"), TEXT("EditorEngine"), EditorEngineClassName, GEngineIni);
UClass* EditorEngineClass = StaticLoadClass( UEditorEngine::StaticClass(), nullptr, *EditorEngineClassName);

And here’s a comment from Commandlet.h:

/**
 * Whether to load objects required in server, client, and editor context.  If IsEditor is set to false, then a
 * UGameEngine (or whatever the value of /Script/Engine.Engine.GameEngine is) will be created for the commandlet instead
 * of a UEditorEngine (or /Script/Engine.Engine.EditorEngine), unless the commandlet overrides the CreateCustomEngine method.
 */
1 Like

You are right!
Some function do not implement in EditorEngine, such as “SelectActor”, so it will failed to call in commandlet mode.