런타임 로딩 메모 (패키징/Shipping)
패키징된 앱에서 Blueprint를 로드할 때는 에셋 경로보다 GeneratedClass(`_C`) 경로를 우선 사용한다.
- 에디터: `"/Path/Asset.Asset"`(UBlueprint) 로드가 동작할 수 있음
- 패키징 런타임: UBlueprint 원본은 제거/비보장될 수 있음
- 런타임 안정 경로: `"/Path/Asset.Asset_C"`(UClass)
`_C` 클래스로 `NewObject`를 만들면 CDO 기본값(머티리얼 셋 포인터 등)이 인스턴스에 적용된다.
static UClass* TryLoadAssetListClassFromPath(const FSoftObjectPath& Path)
{
if (Path.IsNull()) {
return nullptr;
}
// 1) 런타임 우선: GeneratedClass(_C)
const FString ObjectPath = Path.ToString();
const FString PackageName = FPackageName::ObjectPathToPackageName(ObjectPath);
const FString AssetName = FPackageName::ObjectPathToObjectName(ObjectPath);
if (!PackageName.IsEmpty() && !AssetName.IsEmpty()) {
const FString ClassPath = PackageName + TEXT(".") + AssetName + TEXT("_C");
if (UClass* Cls = FSoftClassPath(ClassPath).TryLoadClass<UVrmAssetListObject>()) {
return Cls;
}
}
// 2) 에디터/개발환경 fallback
if (UObject* Loaded = Path.TryLoad()) {
if (const UBlueprint* BP = Cast<UBlueprint>(Loaded)) {
if (BP->GeneratedClass && BP->GeneratedClass->IsChildOf(UVrmAssetListObject::StaticClass())) {
return BP->GeneratedClass;
}
}
if (UClass* Cls = Cast<UClass>(Loaded)) {
if (Cls->IsChildOf(UVrmAssetListObject::StaticClass())) {
return Cls;
}
}
}
return nullptr;
}
'Programming > UE5' 카테고리의 다른 글
| Data Asset에서 Bone Hierarchy으로 bone을 선택 할 수 있게 만들기 (0) | 2026.03.12 |
|---|---|
| 언리얼 엔진 서드파티 종속성 못 잡을 때 / Unreal Engine Thirdparty dll 126 Error (0) | 2026.03.04 |
| [Udemy] 컨트롤 릭(Control Rig) 강의 듣는 중 (1) | 2024.09.14 |
| HD - 2D(?)에서 Mouse Cursor to World location (0) | 2024.06.10 |
| [Udemy] 언리얼로 2D 게임 만들기 찍먹 (0) | 2024.06.05 |