[Unreal] 블루프린트 컴파일시 조건에 안 맞으면 에러 발생 시키기 프로젝트명 : SingleProject 1. UBlueprintCompilerExtension를 상속 받아 ProcessBlueprintCompiled를 재정의ex) #pragma once#include "CoreMinimal.h"#include "BlueprintCompilerExtension.h"#include "SPBlueprintCompilerExtension.generated.h"/** * */UCLASS()class SINGLEPROJECT_API USPBlueprintCompilerExtension : public UBlueprintCompilerExtension{ GENERATED_BODY() public: virtual void ProcessBlueprintCompiled(const F.. 2025. 12. 6. [Unreal] 에디터에서 Tick 처리 virtual bool ShouldTickIfViewportsOnly() const override 를 오버라이딩 void ATestOBB::Tick(float DeltaTime) { #if WITH_EDITOR if (nullptr != GetWorld() && GetWorld()->WorldType == EWorldType::Editor) { // 에디터 처리 return; } #endif Super::Tick(DeltaTime); } bool ATestOBB::ShouldTickIfViewportsOnly() const { // 체크 if (nullptr != GetWorld() && GetWorld()->WorldType == EWorldType::Editor) { return true; } el.. 2024. 4. 10. [Unreal] 에디트 상황에서 컴포넌트 생성/해제 콜백 ex) ObstacleComponent 라는 컴포넌트가 있고 이 컴포넌트안의 Collider객체를 컴포넌트가 생성될때 매니저에 등록하고 제거될때 빠져야 하는 상황 OnReigster()에서 객체가 생성되어있는지 체크하고 객체를 생성 OnComponentDestroyed() 에서 객체를 해제 * OnRegister()는 Actor::PostEditChangeProperty()에서 호출되기 때문에 자주 호출됨 객체를 생성해야 한다면 객체의 존재여부를 체크해서 한번만 생성되도록 처리 * OnUnregister()의 경우에도 Actor::PreEditChange()에서 호출되기 때문에 자주 호출됨 OnRegister / OnUnregister의 조합으로 사용하는 경우 자주 등록/해제 처리가 발생 * OnComp.. 2024. 3. 24. [Unreal] 에디트 시점에 컴포넌트 시각화 Capsule Collision Component 처럼 에디트 시점에 컴포넌트의 모양을 출력 1. FDebugRenderSceneProxy를 상속받아 다음처럼 옵션을 설정 class FTestDebugRenderSceneProxy : public FDebugRenderSceneProxy { public: FTestDebugRenderSceneProxy(const UPrimitiveComponent* InComponent) : FDebugRenderSceneProxy(InComponent) { } virtual FPrimitiveViewRelevance GetViewRelevance(const FSceneView* View) const override { FPrimitiveViewRelevance Resu.. 2024. 3. 20. [Unreal] 에디터 유틸리티 위젯을 사용하여 에디터 창 띄우기 1. 에디터 유틸리티 위젯 생성 2. UserWidget을 상속받아 기능을 처리할 위젯을 만들어 에디터 유틸리티 위젯에 배치 3. 특정 상황에 에디터 유틸리티 위젯을 띄운다 에디터 유틸리티 위젯 생성 UserWidget을 상속받아 기능을 처리할 위젯을 만들어 에디터 유틸리티 위젯에 배치 BP_TestPlay라는 유저 위젯을 만들고 BT_TestEditorWidget에 배치 특정 상황에 에디터 유틸리티 위젯을 띄운다 void FTestProjectTools::OnClickMenuCommand1() { FString path = TEXT("/Game/BP_TestEditorWidget.BP_TestEditorWidget"); UWidgetBlueprint* Blueprint = Cast(UEditorAsse.. 2023. 12. 30. [Unreal] 메뉴 추가 순서 - 사용할 커맨드 추가- FExtender를 이용하여 메뉴를 확장 FUICommandList 를 사용하려면 [프로젝트].Build.cs에 "Slate","SlateCore" 모듈을 추가해주어야 한다PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "Slate", "SlateCore"}); 사용할 커맨드 추가1. TCommands를 상속 받은 클래스를 하나 만든다2. 사용할 커맨드를 선언3. RegisterCommands를 재정의해서 UI_COMMAND 매크로로 커맨드를 등록 .h#pragma once#include "CoreMinimal.h"/** * */class FTestProjectTools.. 2023. 12. 27. 이전 1 다음