Get Focused window?

I am making a plugin and I want to get the currently focused editor window (specifically the blueprint editor), does anyone know a way to do this?

Thanks

Try this function, it should works.

IAssetEditorInstance* GetFucusedEditor()
{
FAssetEditorManager& assetEditorManager = FAssetEditorManager::Get();
TArray<UObject*> editedAssets = assetEditorManager.GetAllEditedAssets();
TArray<IAssetEditorInstance*> openedEditors;

for (UObject* editedAsset : editedAssets)
{
	openedEditors.Add(assetEditorManager.FindEditorForAsset(editedAsset, false));
}

IAssetEditorInstance* focusedEditor = nullptr;
double maxLastActivationTime = 0.0;

for (IAssetEditorInstance* openedEditor : openedEditors)
{
	if (openedEditor && openedEditor->GetLastActivationTime() > maxLastActivationTime)
	{
		maxLastActivationTime = openedEditor->GetLastActivationTime();
		focusedEditor = openedEditor;
	}
}

return focusedEditor;

}

Maybe it help.

1 Like