Pawn/Pawn_Unreal/Source/Pawn/PawnModule.cpp

25 lines
1.1 KiB
C++

#include "PawnModule.h"
#include "PropertyEditorModule.h"
#include "Interaction/PwnInteractableActor.h"
#include "Interaction/PwnInteractableActorCustomization.h"
#include "Modules/ModuleManager.h"
IMPLEMENT_PRIMARY_GAME_MODULE(FPawnModule, Pawn, "Pawn");
void FPawnModule::StartupModule() {
FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
PropertyModule.RegisterCustomPropertyTypeLayout(FPwnInteractableActor::StaticStruct()->GetFName(),
FOnGetPropertyTypeCustomizationInstance::CreateStatic(
&UPwnInteractableActorCustomization::MakeInstance));
PropertyModule.NotifyCustomizationModuleChanged();
}
void FPawnModule::ShutdownModule() {
if (FModuleManager::Get().IsModuleLoaded("PropertyEditor")) {
FPropertyEditorModule& PropertyModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor");
PropertyModule.UnregisterCustomPropertyTypeLayout(FPwnInteractableActor::StaticStruct()->GetFName());
PropertyModule.NotifyCustomizationModuleChanged();
}
}