UE4
[UE4] OpenLevel
TigerFish
2022. 8. 22. 00:24
글을 쓰는 이유
OpenLevel 사용법을 기록하기 위해 글을 쓴다.
작업 환경
UE4.26
OpenLevel 사용법
UGamePlayStatics::OpenLevel 을 사용하면 레벨을 로드 할 수 있다. levelName에 Level을 쓸 수도 있지만 Level을 찾는 검색시간이 상당히 오래 걸리기 때문에 full path로 쓰는게 좋다. 또한 Option을 통해 게임 모드를 로드하는 레벨에 설정할 수 있다.
FString option = TEXT("?game=/Game/Blueprint/GameMode/TestGameModeBP.TestGameModeBP_C");
FString levelName = L"/Game/Maps/TestLevel"
UGameplayStatics::OpenLevel(inWorld, *levelName, true, option);
참고
https://forums.unrealengine.com/t/change-gamemode-on-open-level/296156/2
Change GameMode on Open Level
Hi OhiraKyou, I apologize for the delayed reply, your post seems to have been buried and we just found it. Are you still experiencing this error?
forums.unrealengine.com
https://docs.unrealengine.com/4.27/en-US/API/Runtime/Engine/Kismet/UGameplayStatics/OpenLevel/
UGameplayStatics::OpenLevel
Travel to another level
docs.unrealengine.com