새소식

개발/UE4

[UE4/Tip] UObject Rename 함수와 FlushAsyncLoading

  • -

UObject의 Rename 함수는 3개의 파라미터를 받는다.

UObject::Rename( const TCHAR* InName, UObject* NewOuter, ERenameFlags Flags )

이 중 Flags에는 아래와 같은 옵션이 존재하는데,

/** Default rename behavior */
#define REN_None            (0x0000)
/** Rename won't call ResetLoaders or flush async loading. You should pass this if you are renaming a deep subobject and do not need to reset loading for the outer package */
#define REN_ForceNoResetLoaders       (0x0001) 
/** Just test to make sure that the rename is guaranteed to succeed if an non test rename immediately follows */
#define REN_Test               (0x0002) 
/** Indicates that the object (and new outer) should not be dirtied */
#define REN_DoNotDirty          (0x0004) 
/** Don't create an object redirector, even if the class is marked RF_Public */
#define REN_DontCreateRedirectors  (0x0010) 
/** Don't call Modify() on the objects, so they won't be stored in the transaction buffer */
#define REN_NonTransactional      (0x0020) 
/** Force unique names across all packages not just within the scope of the new outer */
#define REN_ForceGlobalUnique     (0x0040) 
/** Prevent renaming of any child generated classes and CDO's in blueprints */
#define REN_SkipGeneratedClasses   (0x0080) 

이 중 REN_ForceNoResetLoaders 에 대한 비트 플래그가 활성화되어 있지 않으면, Rename 함수 내부에서 Linker의 ResetLoaders 함수를 호출 시킨다.

void ResetLoaders(UObject* InPkg)
{
   if (IsAsyncLoading())
   {
      UE_LOG(LogLinker, Log, TEXT("ResetLoaders(%s) is flushing async loading"), *GetPathNameSafe(InPkg));
   }

   // Make sure we're not in the middle of loading something in the background.
   FlushAsyncLoading();
   FLinkerManager::Get().ResetLoaders(InPkg);
}

Linker에 정의되어있는 Global 함수 ResetLoader 내부를 보면, FlushAsyncLoading을 수행하는걸 볼 수 있는데, 이는 AsyncLoadingThread가 들고 있는 Request 를 모두 Flush 시킨다.

 

이는, 구현부에 따라 다르겠지만, 필수적으로 로드해야 하는 패키지인 경우엔 무한 로딩 혹은, 동기 로딩을 유발시켜 Level Streaming과 같은 비동기 로드 리퀘스트를 동기로드로 변환하여 히치를 발생시키는 원인이 될 수 있다.

Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.