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