Unreal Engine 5 C++: Create Custom Editor Tools

0.Modules

  • Modules enforce good code separation
  • All modules require a  [ModuleName].Build.cs
  • Outside modules can be included by adding them to the Build.cs file

1. Create a blank uplugin

Name

The name for plugin could not be changed !!!

"LoadingPhase":

"PreDefault"/ "Default"

PreDefault会在游戏模块之前加载

Type

对Game code产生影响的插件选择runtime的type,这里的SuperManager插件选择“Editor"Type

2. Creat Asset Action Utility C++ (renamed QuickAssetActions)

AssetActionUtility

ActorActionUtility

header file put into public

cpp file into private

3.调用头文件

在源文件中,使用#include指令来包含头文件。

Outside modules can be included by adding them to the Build.cs file  如下

		PrivateIncludePaths.AddRange(
			new string[] {
		    System.IO.Path.GetFullPath(Target.RelativeEnginePath)+"/Source/Editor/Blutility/Private"
			//"D:\\Epic Games\\UE_5.2\\Engine\\Source\\Editor\\Blutility\\Private"
			//Path.Combine(Target.RelativeEnginePath, "Source", "Editor", "Blutility", "Private")
            }
			);
			
		
		PublicDependencyModuleNames.AddRange(
			new string[]
			{
				"Core","Blutility"
				// ... add other public dependencies that you statically link with here ...
			}
			);

Debug

1.Add an Editor Utility Blueprint (renamed EUB_dummy) and set Quick Asset Action to be Parent Class

2.Make sure you have the editor closed before compile.

4.Create A Debug Header

DebugHeader.h

#pragma once

void Print(const FString& Message, const FColor& Color)
{
	if (GEngine)
	{
		GEngine->AddOnScreenDebugMessage(-1, 8.f, Color, Message);
	}
}

void PrintLog(const FString& Message)
{
	UE_LOG(LogTemp, Warning, TEXT("%s"),*Message);
}

QuickAssetAction.cpp

// Fill out your copyright notice in the Description page of Project Settings.


#include "AssetAction/QuickAssetAction.h"
#include "DebugHeader.h"

void UQuickAssetAction::TestFuckingFunc()
{
	Print(TEXT("I hate the plugin"), FColor::Cyan);
	PrintLog(TEXT("杀杀杀"));

	//if (GEngine) 
	//{
	//	GEngine->AddOnScreenDebugMessage(-1, 8.f, FColor::Yellow, TEXT("I hate this plugin"));
	//}
}

5.Asset Batch Duplication

Scripting Libraries:

1.UEditorUtilityLibrary

2.UEditorAssetLibrary

Try to include EditorUtilityLibrary and EditorAssetLibrary in your .cpp file

  • 34
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值