Any way to force the editor to build on restart?

Hi there.

I’m writing an editor plugin, and this involves generating classes and adding them to the source folder.

Obviously, these come without the generated headers, so I can’t just hotreload them.

I have to build from VS, then open the editor.

I’m aware I can force the editor to restart through UnrealEd.

Is there any way I can ask the editor to rebuild the project files on said restart, similar to how it does when the editor detects an incorrect version or missing module files?

Cheers!

When I’m coding stuff for Unreal (and I’m ready to test something), I just start the editor directly from Visual Studio. The code will compile, and the project will open up with the editor. If I have to create a new class, I usually do that from the editor as well, because in the past I’ve had issues with including files.

Yes, I understand that process.

It’s an editor plugin, however, and has a tab (in editor) with a ‘generate code’ button. The source files get added while the editor is still running.

I don’t want the user of my plugin to have to touch visual studio during this process, so I give them a ‘restart editor’ button.
I want this restart editor button to also force the editor to build the project files when it starts.

Is there any way to do that?

Bump? (Surely someone on staff knows)

For those interested


FReply FAdvancedClassWizardModule::HandleRestartButtonClicked() const
{
// Check if config file is already set to auto recompile on startup.
bool bAutoRecompile = false;
GConfig->GetBool(TEXT("/Script/UnrealEd.EditorLoadingSavingSettings"), TEXT("bForceCompilationAtStartup"), bAutoRecompile, GEditorPerProjectIni);
UE_LOG(LogGenerator, Log, TEXT("AutoRecompile was: %b"), bAutoRecompile);
if(!bAutoRecompile)
{
GConfig->SetBool(TEXT("/Script/UnrealEd.EditorLoadingSavingSettings"), TEXT("bForceCompilationAtStartup"), true, GEditorPerProjectIni);
GConfig->Flush(false, GEditorPerProjectIni);
UE_LOG(LogGenerator, Log, TEXT("Enabling Editor Auto Recompile at Startup"));
}

const bool bWarn = false;
FUnrealEdMisc::Get().RestartEditor(bWarn);
return FReply::Handled();
}