Can't include EditorAssetLibrary.h

Greetings!

I’m trying to get my hand at building editor tools in C++ and I see that the UEditorAssetLibrary class has a lot of nice utility I would like to call.

Link to doc : UEditorAssetLibrary | Unreal Engine Documentation

However, I can’t figure out how to call it from my C++ class. When I #include “EditorLevelLibrary.h” I always receive an error telling me “cannot open source file” and the editor tells me “Cannot open include file: ‘EditorAssetLibrary.h’: No such file or directory”

Do anyone know what I’m doing wrong?
I have the Editor scripting Utilities plugin, The Python Editor Script Plugin and the Sequencer Scripting Plugin enabled.

Here is my .h file :
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "EditorUtilityActor.h"
#include "Modules/ModuleManager.h"
#include "Engine/AssetManager.h"
#include "EditorAssetLibrary.h"
#include "MyEditorUtilityActor.generated.h"

/**
 * 
 */
UCLASS()
class DEMORECTEST1_API AMyEditorUtilityActor : public AEditorUtilityActor
{
	GENERATED_BODY()


		UFUNCTION(BlueprintCallable)
		void DoSomething();
};

Thanks for your help!

I solved my problem by adding “EditorScriptingUtilities” as module in my uproject.

I don’t know if this is the correct procedure but my code compile now.

Here is a snippet :

	"Modules": [
		{
			"Name": "DemoRecTest1",
			"Type": "Runtime",
			"LoadingPhase": "Default",
			"AdditionalDependencies": [
				"Engine",
				"Blutility",
				"EditorScriptingUtilities"
			]
		}
	],

Will mark as complete but feel free to add comments if what I’m doing is wrong.

1 Like

Hi, I tried your solutions, it can compile but seems it cannot build project in my side, how is yours? Thanks

me to how to do it? con not include “EditorUtilityActor.h”

What I did was to:

  1. Open .Build.cs file add “EditorScriptingUtilities” to PrivateDependencyModuleNames similar to module in my uproject and save.
  2. Close the IDE compiler and regenerate solution file.
  3. Open the solution file and it should work.