[언리얼 엔진] Referencing Assets 쿠킹 테스트

2023. 3. 24. 22:30·언리얼 엔진

목표

https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/ProgrammingWithCPP/Assets/ReferencingAssets/

위 docs에서 나온 4가지 방식으로 Reference된 Asset이 패키지 빌드에서 쿠킹되는지 여부를 테스트해봅시다.

프로젝트 세팅에서 CookAll = false, MapsToCook 옵션으로 쿠킹할 맵을 지정해주었다는 가정입니다.

 


1.  Direct Property Reference

UPROPERTY(EditDefaultsOnly)
UStaticMesh* TestStaticMesh;

하드레퍼런스라고도 부르며 Root set에서 Reference되면 쿠킹됩니다.

 


2. Construction Time Reference

이 경우가 가장 궁금했는데, 쿠킹됩니다.

AMyCharacter::AMyCharacter()
{
  ...
  static ConstructorHelpers::FClassFinder<AActor> LoadByConsClass(TEXT("/Game/BPLoadTest/BP_LoadByConstructor.BP_LoadByConstructor_C"));
  if (LoadByConsClass.Succeeded())
  {
		UE_LOG(LogTemp, Log, TEXT("BP_LoadByConstructor_C loaded successfully."));
  }
  else
  {
		UE_LOG(LogTemp, Log, TEXT("BP_LoadByConstructor_C load fail."));
  }
}

construction time reference

 

 


3. Indirect Property Reference

TSoftObjectPtr, FSoftObjectPath 같이 명시적 로드 전에는 path 정보만 가지고있는 Indirect Property Reference입니다.

쿠킹됩니다.

UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TSoftObjectPtr<UStaticMesh> TestMesh;

Indirect Property Reference
Indirect Property Reference

 


4. Find/Load Object

런타임에 raw path string으로 Find/Load 하는 경우입니다.

쿠킹되지 않습니다.

해당 예시코드는 애셋 경로 변경 시 버그를 일으킬 수 있고 쿠킹되지 않기 때문에 지양해야할 코드이며

1,2,3번 방식의 Reference로 수정해야합니다.

FString ClassPath = TEXT("/Game/BPLoadTest/BP_LoadByPath.BP_LoadByPath_C");
UClass* MyClass = StaticCast<UClass*>(StaticLoadObject(UClass::StaticClass(), NULL, *ClassPath));

if (MyClass)
{
	UE_LOG(LogTemp, Log, TEXT("%s loaded successfully."), *ClassPath);
}
else
{
	UE_LOG(LogTemp, Log, TEXT("%s load fail."), *ClassPath);
}

 

'언리얼 엔진' 카테고리의 다른 글

[Unreal Engine 5] Virtual Shadow Map  (1) 2025.07.29
[Unreal Engine 5] Nanite Basepass 분석  (5) 2025.07.25
Expert's guide to unreal engine performance  (0) 2023.09.01
UE5.1 Planar reflection과 VSM 동시 사용 시 프레임 드랍 문제  (0) 2023.08.03
[언리얼 엔진] 블루프린트 String Path로 로드 시 주의할 점  (2) 2023.03.20
'언리얼 엔진' 카테고리의 다른 글
  • [Unreal Engine 5] Nanite Basepass 분석
  • Expert's guide to unreal engine performance
  • UE5.1 Planar reflection과 VSM 동시 사용 시 프레임 드랍 문제
  • [언리얼 엔진] 블루프린트 String Path로 로드 시 주의할 점
jooh3444
jooh3444
게임엔진 / 그래픽스 개발 블로그
  • jooh3444
    Jooh 개발 블로그
    jooh3444
  • 전체
    오늘
    어제
    • Dev blog (18)
      • OpenGL (7)
        • CS-248 셰이더 프로그래밍 (7)
      • 언리얼 엔진 (7)
      • 기타 (1)
      • Computer Graphics (3)
  • 블로그 메뉴

    • 홈
    • About
    • github
  • 인기 글

  • 태그

    bDontLoadBlueprintOutsideEditor
    Enviroment Lighting
    셰이더 프로그래밍
    multi-scattering brdf
    Computer Graphics
    Unreal Engine
    범프 매핑
    twopass occlusion culling
    Shader Programming
    Blueprint load by path
    Virtual Shadow Map
    Nanite
    UE5 bugfix
    Shadow map
    UE5
    Unreal Engine 5
    셰이더
    OpenGL
    Shader
    그래픽스
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
jooh3444
[언리얼 엔진] Referencing Assets 쿠킹 테스트
상단으로

티스토리툴바