[언리얼] 게임인스턴스서브시스템에서 constructionhelper사용하기

jh Seo·2024년 11월 15일

언리얼

목록 보기
11/18
UCLASS()
class OCTOADVENTURE_API UAsyncLoadingSubsystem : public UGameInstanceSubsystem
{
	GENERATED_BODY()
	UAsyncLoadingSubsystem();
public:
	virtual void Initialize(FSubsystemCollectionBase& Collection) override;

현재 async loading을
FLoadingScreenAttributes와 UGameplayStatics::OpenLevelBySoftObjectPtr(this , Level);
을 이용해 구현 중이다.

로딩스크린에 해당하는 위젯 블루프린트를 construction helper로 불러오는 작업을 했다.
여기서 문제는 생성자 UAsyncLoadingSubsystem() 에서 construction helper로 불러오는 데
계속 크래쉬가 났다.

해결

GameInstanceSubsystem은 construction helper 사용을 생성자가 아니라 Initialize에서 해야한다.

virtual void Initialize(FSubsystemCollectionBase& Collection) override;

생성자가 아닌 initialize에서 해야 다른 서브시스템들이랑 상호작용이 가능해진다고 한다.

profile
코딩 창고!

0개의 댓글