잘못된 부분
MergedMesh = SkeletalMeshMergeData.GetDefaultSkeletalMesh().Get();
수정된 부분
TSoftObjectPtr<USkeletalMesh> DafualtSkeletalMesh = SkeletalMeshMergeData.GetDefaultSkeletalMesh();
MergedMesh = DafualtSkeletalMesh.LoadSynchronous();
TSoftObjectPtr의 Get() 함수는 Editor에서 사용되는 Editor 전용 함수이다.
#if WITH_EDITOR
/** Overridden to deal with PIE lookups */
FORCEINLINE UObject* Get() const
{
if (GPlayInEditorID != INDEX_NONE)
{
// Cannot use or set the cached value in PIE as it may affect other PIE instances or the editor
TWeakObjectPtr<UObject> Result = GetUniqueID().ResolveObject();
// If this object is pending kill or otherwise invalid, this will return nullptr just like TPersistentObjectPtr<FSoftObjectPath>::Get()
return Result.Get();
}
return TPersistentObjectPtr<FSoftObjectPath>::Get();
}
#endif
#if WITH_EDITOR 전처리기로 스코프가 설정된 것을 확인할 수 있다. 따라서 native에서 TSoftObjectPtr의 Load를 위해 Get() 함수를 사용하면, 에디터에서는 문제가 없지만, 쿠킹 이후에 문제가 생길 수 있다.
앞으로…
- 앞으로 모르는 함수를 사용할 땐 꼭 함수 내부를 보고 어떻게 동작하는지 확인하자.
- 우리 코드에서 비슷한 내용을 찾아 어떻게 사용하고 있는지 참고한다.