基于 UGameplayStatics::
-
OenLevel
UGameplayStatics::OpenLevel(GetWorld(), TEXT("NewMap"));
-
OpenLevelBySoftObjectPtr
FSoftObjectPath NewMapPath(TEXT("World'/Game/CPPFunction/Interface/NewMap.NewMap'"));
TSoftObjectPtr<UWorld> NewMap(NewMapPath);
UGameplayStatics::OpenLevelBySoftObjectPtr(GetWorld(), NewMap);
获取当前关卡名
异步加载关卡
参考——异步加载关卡
流关卡
基于 UGameplayStatics::
加载
-
UGameplayStatics::LadStreamLevel
static void LoadStreamLevel(const UObject* WorldContextObject, FName LevelName, bool bMakeVisibleAfterLoad, bool bShouldBlockOnLoad, FLatentActionInfo LatentInfo);
-
UGameplayStatics::LoadStreamLevelBySoftObjectPtr
static void LoadStreamLevelBySoftObjectPtr(const UObject* WorldContextObject, const TSoftObjectPtr<UWorld> Level, bool bMakeVisibleAfterLoad, bool bShouldBlockOnLoad, FLatentActionInfo LatentInfo);
卸载
-
UnloadStreamLevel
static void UnloadStreamLevel(const UObject* WorldContextObject, FName LevelName, FLatentActionInfo LatentInfo, bool bShouldBlockOnUnload);
-
UnloadStreamLevelBySoftObjectPtr
static void UnloadStreamLevelBySoftObjectPtr(const UObject* WorldContextObject, const TSoftObjectPtr<UWorld> Level, FLatentActionInfo LatentInfo, bool bShouldBlockOnUnload);
获取流关卡
退出游戏
-
ConsoleCommand,以此类推,可以执行多种命令行
UGameplayStatics::GetPlayerController(GWorld, 0)->ConsoleCommand("quit")
|
请发表评论