A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
UStreamingLevelManager Class ReferenceBlueprintable

Manager that provides functionality for managing streaming levels. Two options to use this class: More...

#include <StreamingLevelManager.h>

Inheritance diagram for UStreamingLevelManager:
[legend]

Public Member Functions

 UStreamingLevelManager ()
 
 DECLARE_EVENT_HANDLER (UNewStepLoadedEvent)
 
 DECLARE_EVENT_HANDLER (UNewStoryLoadedEvent)
 
TArray< FName > GetLevelsBasedOnStep (FText StepName)
 UFUNCTION(BlueprintCallable, Category = "LevelStreamingManager")
 
APlayerControllerGetPrivateOwner () const
 
void HandleEvent (UBaseEvent *Event)
 
void LoadStreamingLevels (TArray< FName > levelsToLoad, bool onlyFadeOut=false, float FadeTime=0.5f)
 Calling due to LevelStreamingDataTable, but you also can call it manually. In addition, you can setup AutoFadeInAndOut before calling.
 
void LoadStreamingLevelsAndTeleportPlayer (TArray< FName > Levels, FTransform PlayerTransform, bool OnlyFadeOut=false, float FadeTime=0.5f)
 Call it manually, if you want to teleport player to specific location after loading levels.
 
template<typename TEventType , typename... TInitializeArgs>
void SendEvent (TInitializeArgs... Arguments)
 
void SetLevelsVisibility (TArray< FName > Levels, bool Visible)
 UFUNCTION(BlueprintCallable, Category = "LevelStreamingManager")
 
void SetPrivateOwner (APlayerController *Owner)
 

Public Attributes

bool AutoFadeInAndOut = true
 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LevelStreamingManager")
 
UDataTable * LevelStreamingDataTable
 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LevelStreamingManager")
 
TArray< FName > LoadedLevels
 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "LevelStreamingManager")
 

Protected Member Functions

void FilteredArraysToLoadUnload (TArray< FName > levelsToLoad)
 This function takes an array of levels to load and filters the arrays LevelsToLoad and LevelsToUnload accordingly. It compares the provided levels with the currently loaded levels (LoadedLevels) to determine which levels should be loaded and which should be unloaded.
 
void HandleEvent_Impl (class UBaseEvent *Event)
 
void LevelLoaded ()
 UFUNCTION()
 
void LevelUnloaded ()
 UFUNCTION()
 
void LoadStreamingLevels (int32 IndexToLoad)
 This function loads a specific streaming level based on the provided index.
 
void UnloadStreamingLevels (int32 IndexToUnload)
 This function unloads a specific streaming level based on the provided index.
 

Protected Attributes

THandlers Handlers
 
TArray< FName > LevelsToLoad
 Array storing the levels to load.
 
TArray< FName > LevelsToUnload
 Array storing the levels to unload.
 
int32 LoadingIndex
 Index for tracking the loading progress.
 
FTransform PlayerNewTransform
 Transform representing the new location for the player after loading levels.
 
bool TeleportPlayerToSpecificLocation = false
 Determines whether to teleport the player to a specific location after loading levels.
 
int32 UnloadingIndex
 Index for tracking the unloading progress.
 

Private Types

using THandler = TFunction<void(UBaseEvent*)>
 
using THandlerKey = UClass*
 
using THandlers = std::unordered_map<THandlerKey, THandler, THandlerHash, THandlerComp>
 

Private Member Functions

 GENERATED_BODY ()
 

Private Attributes

APlayerControllerPrivateOwner
 UPROPERTY()
 
float TimeForFades
 Time duration for fade effects.
 

Detailed Description

Manager that provides functionality for managing streaming levels. Two options to use this class:

  1. Using with StoryManager, when step change it would activate level loading you must attach data table to LevelStreamingDataTable, struct for the data table is FStreamingLevel
  2. Manually load levels using LoadStreamingLevels or LoadStreamingLevelsAndTeleportPlayer

UCLASS(Blueprintable)

Definition at line 56 of file StreamingLevelManager.h.

Member Typedef Documentation

◆ THandler

using UBaseManager::THandler = TFunction<void(UBaseEvent*)>
privateinherited

Definition at line 56 of file BaseManager.h.

◆ THandlerKey

using UBaseManager::THandlerKey = UClass*
privateinherited

Definition at line 55 of file BaseManager.h.

◆ THandlers

using UBaseManager::THandlers = std::unordered_map<THandlerKey, THandler, THandlerHash, THandlerComp>
privateinherited

Definition at line 74 of file BaseManager.h.

Constructor & Destructor Documentation

◆ UStreamingLevelManager()

UStreamingLevelManager::UStreamingLevelManager ( )

Definition at line 13 of file StreamingLevelManager.cpp.

Member Function Documentation

◆ DECLARE_EVENT_HANDLER() [1/2]

UStreamingLevelManager::DECLARE_EVENT_HANDLER ( UNewStepLoadedEvent )

◆ DECLARE_EVENT_HANDLER() [2/2]

UStreamingLevelManager::DECLARE_EVENT_HANDLER ( UNewStoryLoadedEvent )

◆ FilteredArraysToLoadUnload()

void UStreamingLevelManager::FilteredArraysToLoadUnload ( TArray< FName > levelsToLoad)
protectedBlueprintCallable

This function takes an array of levels to load and filters the arrays LevelsToLoad and LevelsToUnload accordingly. It compares the provided levels with the currently loaded levels (LoadedLevels) to determine which levels should be loaded and which should be unloaded.

Parameters
levelsToLoadThe array of levels to load.

UFUNCTION(BlueprintCallable, Category = "LevelStreamingManager")

Definition at line 53 of file StreamingLevelManager.cpp.

Here is the caller graph for this function:

◆ GENERATED_BODY()

UStreamingLevelManager::GENERATED_BODY ( )
private

◆ GetLevelsBasedOnStep()

TArray< FName > UStreamingLevelManager::GetLevelsBasedOnStep ( FText StepName)
BlueprintCallable

UFUNCTION(BlueprintCallable, Category = "LevelStreamingManager")

Retrieves levels based on the step name.

Definition at line 20 of file StreamingLevelManager.cpp.

◆ GetPrivateOwner()

APlayerController * UBaseManager::GetPrivateOwner ( ) const
inlineinherited

Definition at line 47 of file BaseManager.h.

Here is the caller graph for this function:

◆ HandleEvent()

void UBaseManager::HandleEvent ( UBaseEvent * Event)
inherited

Definition at line 11 of file BaseManager.cpp.

◆ HandleEvent_Impl()

void UBaseManager::HandleEvent_Impl ( class UBaseEvent * Event)
protectedinherited

Definition at line 24 of file BaseManager.cpp.

◆ LevelLoaded()

void UStreamingLevelManager::LevelLoaded ( )
protected

UFUNCTION()

This function is called when a level is successfully loaded.

Definition at line 164 of file StreamingLevelManager.cpp.

Here is the call graph for this function:

◆ LevelUnloaded()

void UStreamingLevelManager::LevelUnloaded ( )
protected

UFUNCTION()

This function is called when a level is successfully unloaded.

Definition at line 169 of file StreamingLevelManager.cpp.

Here is the call graph for this function:

◆ LoadStreamingLevels() [1/2]

void UStreamingLevelManager::LoadStreamingLevels ( int32 IndexToLoad)
protected

This function loads a specific streaming level based on the provided index.

Parameters
IndexToLoadThe index of the level to load.

Definition at line 215 of file StreamingLevelManager.cpp.

Here is the call graph for this function:

◆ LoadStreamingLevels() [2/2]

void UStreamingLevelManager::LoadStreamingLevels ( TArray< FName > levelsToLoad,
bool onlyFadeOut = false,
float FadeTime = 0.5f )
BlueprintCallable

Calling due to LevelStreamingDataTable, but you also can call it manually. In addition, you can setup AutoFadeInAndOut before calling.

Parameters
levelsToLoadLevels you want to load
onlyFadeOutDo only Fade Out (useful when you load the first level)
FadeTimeOptional param for custom fade time

UFUNCTION(BlueprintCallable, Category = "LevelStreamingManager")

Definition at line 77 of file StreamingLevelManager.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LoadStreamingLevelsAndTeleportPlayer()

void UStreamingLevelManager::LoadStreamingLevelsAndTeleportPlayer ( TArray< FName > Levels,
FTransform PlayerTransform,
bool OnlyFadeOut = false,
float FadeTime = 0.5f )
BlueprintCallable

Call it manually, if you want to teleport player to specific location after loading levels.

Parameters
LevelsLevels you want to load
OnlyFadeOutDo only Fade Out (useful when you load the first level)
PlayerTransformThe transform where you want the player to be after loading
FadeTimeOptional param for custom fade time

UFUNCTION(BlueprintCallable, Category = "LevelStreamingManager")

Definition at line 136 of file StreamingLevelManager.cpp.

Here is the call graph for this function:

◆ SendEvent()

template<typename TEventType , typename... TInitializeArgs>
void UBaseManager::SendEvent ( TInitializeArgs... Arguments)
inlineinherited

Definition at line 40 of file BaseManager.h.

◆ SetLevelsVisibility()

void UStreamingLevelManager::SetLevelsVisibility ( TArray< FName > Levels,
bool Visible )
BlueprintCallable

UFUNCTION(BlueprintCallable, Category = "LevelStreamingManager")

Sets the visibility of levels.

Definition at line 144 of file StreamingLevelManager.cpp.

◆ SetPrivateOwner()

void UBaseManager::SetPrivateOwner ( APlayerController * Owner)
inlineinherited

Definition at line 46 of file BaseManager.h.

◆ UnloadStreamingLevels()

void UStreamingLevelManager::UnloadStreamingLevels ( int32 IndexToUnload)
protected

This function unloads a specific streaming level based on the provided index.

Parameters
IndexToUnloadThe index of the level to unload.

Definition at line 174 of file StreamingLevelManager.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ AutoFadeInAndOut

bool UStreamingLevelManager::AutoFadeInAndOut = true
EditAnywhereBlueprintReadWrite

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LevelStreamingManager")

Determines if automatic fade in and out effects should be used when loading new levels.

Definition at line 124 of file StreamingLevelManager.h.

◆ Handlers

THandlers UBaseManager::Handlers
protectedinherited

Definition at line 77 of file BaseManager.h.

◆ LevelsToLoad

TArray<FName> UStreamingLevelManager::LevelsToLoad
protected

Array storing the levels to load.

Definition at line 157 of file StreamingLevelManager.h.

◆ LevelsToUnload

TArray<FName> UStreamingLevelManager::LevelsToUnload
protected

Array storing the levels to unload.

Definition at line 158 of file StreamingLevelManager.h.

◆ LevelStreamingDataTable

UDataTable* UStreamingLevelManager::LevelStreamingDataTable
EditAnywhereBlueprintReadWrite

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LevelStreamingManager")

Data table with levels for loading based on step.

Definition at line 110 of file StreamingLevelManager.h.

◆ LoadedLevels

TArray<FName> UStreamingLevelManager::LoadedLevels
VisibleAnywhereBlueprintReadOnly

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "LevelStreamingManager")

Array storing the currently loaded levels.

Definition at line 117 of file StreamingLevelManager.h.

◆ LoadingIndex

int32 UStreamingLevelManager::LoadingIndex
protected

Index for tracking the loading progress.

Definition at line 159 of file StreamingLevelManager.h.

◆ PlayerNewTransform

FTransform UStreamingLevelManager::PlayerNewTransform
protected

Transform representing the new location for the player after loading levels.

Definition at line 163 of file StreamingLevelManager.h.

◆ PrivateOwner

APlayerController* UBaseManager::PrivateOwner
privateinherited

UPROPERTY()

Definition at line 53 of file BaseManager.h.

◆ TeleportPlayerToSpecificLocation

bool UStreamingLevelManager::TeleportPlayerToSpecificLocation = false
protected

Determines whether to teleport the player to a specific location after loading levels.

Definition at line 162 of file StreamingLevelManager.h.

◆ TimeForFades

float UStreamingLevelManager::TimeForFades
private

Time duration for fade effects.

Definition at line 166 of file StreamingLevelManager.h.

◆ UnloadingIndex

int32 UStreamingLevelManager::UnloadingIndex
protected

Index for tracking the unloading progress.

Definition at line 160 of file StreamingLevelManager.h.


The documentation for this class was generated from the following files: