ULevelStreaming

Abstract base class of container object encapsulating data required for streaming and providing interface for when a level should be streamed in and out of memory.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Engine/LevelStreaming.h

Include

#include "Engine/LevelStreaming.h"

Syntax

class ULevelStreaming : public UObject

Remarks

Abstract base class of container object encapsulating data required for streaming and providing interface for when a level should be streamed in and out of memory.

Variables

Name Description

Public variable

bool

 

bClientOnlyVisible

Applied to LoadedLevel

Public variable

uint8: 1

 

bDisableDistanceStreaming

Whether this level streaming object should be ignored by world composition distance streaming, so streaming state can be controlled by other systems (ex: in blueprints)

Public variable

uint8: 1

 

bDrawOnLevelStatusMap

If true, will be drawn on the 'level streaming status' map (STAT LEVELMAP console command)

Public variable

uint8: 1

 

bIsStatic

Whether this level only contains static actors that aren't affected by gameplay or replication.

Public variable

uint8: 1

 

bLocked

Whether this level is locked; that is, its actors are read-only.

Protected variable

uint8: 1

 

bShouldBeLoaded

Whether the level should be loaded

Public variable

uint8: 1

 

bShouldBlockOnLoad

Whether we want to force a blocking load

Public variable

uint8: 1

 

bShouldBlockOnUnload

Whether we want to force a blocking unload

Protected variable

ECurrentState

 

CurrentState

What the current streamed state of the streaming level is

Public variable

TArray< TObject...

 

EditorStreamingVolumes

The level streaming volumes bound to this level.

Public variable

TArray< FString...

 

Keywords

List of keywords to filter on in the level browser

Public variable

float

 

LastVolumeUnloadRequestTime

Time of last volume unload request. Used in preventing spurious unload requests.

Public variable

FLinearColor

 

LevelColor

The level color used for visualization. (Show -> Advanced -> Level Coloration)

Public variable

FTransform

 

LevelTransform

Transform applied to actors after loading.

Protected variable

TObjectPtr< cla...

 

LoadedLevel

Pointer to Level object if currently loaded/ streamed in.

Public variable

TArray< FName >

 

LODPackageNames

LOD versions of this level

Public variable

TArray< FName >

 

LODPackageNamesToLoad

LOD package names on disk

Public variable

float

 

MinTimeBetweenVolumeUnloadRequests

Cooldown time in seconds between volume-based unload requests.

Public variable

FLevelStreaming...

 

OnLevelHidden

Called when level is removed from the world

Public variable

FLevelStreaming...

 

OnLevelLoaded

Called when level is streamed in

Public variable

FLevelStreaming...

 

OnLevelShown

Called when level is added to the world

Public variable

FLevelStreaming...

 

OnLevelUnloaded

Called when level is streamed out

Public variable

FName

 

PackageNameToLoad

If this isn't Name_None, then we load from this package on disk to the new package named PackageName

Protected variable

TObjectPtr< cla...

 

PendingUnloadLevel

Pointer to a Level object that was previously active and was replaced with a new LoadedLevel (for LOD switching)

Protected variable

int32

 

StreamingPriority

The relative priority of considering the streaming level.

Protected variable

ETargetState

 

TargetState

What streamed state the streaming level is transitioning towards

Protected variable

TSoftObjectPtr<...

 

WorldAsset

The reference to the world containing the level to load

Constructors

Name Description

Public function

ULevelStreaming

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function

void

 

AddLevelToCollectionAfterReload()

Public function Static

void

 

BroadcastLevelLoadedStatus

(
    UWorld* PersistentWorld,
    FName LevelPackageName,
    bool bLoaded
)

Traverses all streaming level objects in the persistent world and in all inner worlds and calls appropriate delegate for streaming objects that refer specified level

Public function Static

void

 

BroadcastLevelVisibleStatus

(
    UWorld* PersistentWorld,
    FName LevelPackageName,
    bool bVisible
)

Traverses all streaming level objects in the persistent world and in all inner worlds and calls appropriate delegate for streaming objects that refer specified level

Public function

void

 

ClearLoadedLevel()

Sets the LoadedLevel value to NULL

Public function

ULevelStream...

 

CreateInstance

(
    const FString& UniqueInstanceName
)

Creates a new instance of this streaming level with a provided unique instance name

Public function Static

void

 

DebugDrawLegend

(
    const UWorld* World,
    UCanvas* Canvas,
    const FVector2D& Offset
)

Utility that draws a legend of level streaming status

Public function Static

const TCHAR ...

 

EnumToString

(
    ECurrentState InCurrentState
)

Public function Static

ULevelStream...

 

FindStreamingLevel

(
    const ULevel* Level
)

Public function Const

ECurrentStat...

 

GetCurrentState()

Returns the current loaded/visible state of the streaming level.

Public function Const

const FName ...

 

GetFolderPath()

Get the folder path for this level for use in the world browser. Only available in editor builds

Public function Virtual Const

TOptional< F...

 

GetFolderRootObject()

Public function Const

bool

 

GetIsRequestingUnloadAndRemoval()

Returns if the streaming level has requested to be unloaded and removed.

Public function Const

int32

 

GetLevelLODIndex()

Returns the world composition level LOD index.

Public function

ALevelScript...

 

GetLevelScriptActor()

Returns the Level Script Actor of the level if the level is loaded and valid

Public function Const

EStreamingSt...

 

GetLevelStreamingStatus()

Used for debugging Level's status

Public function Static

FColor

 

GetLevelStreamingStatusColor

(
    EStreamingStatus Status
)

Utility that gets a color for a particular level status

Public function Static

const TCHAR ...

 

GetLevelStreamingStatusDisplayName

(
    EStreamingStatus Status
)

Utility that returns a string for a streaming level status

Public function Const

ULevel *

 

GetLoadedLevel()

Gets a pointer to the LoadedLevel value

Protected function Const

FName

 

GetLoadedLevelPackageName()

Public function Const

int32

 

GetPriority()

Sets the relative priority of considering the streaming level.

Public function Const

bool

 

GetShouldBeVisibleFlag()

Returns the value of bShouldBeVisible.

Public function Const

bool

 

GetShouldBeVisibleInEditor()

Returns if the streaming level should be visible in the editor.

Public function

FBox

 

GetStreamingVolumeBounds()

Get a bounding box around the streaming volumes associated with this LevelStreaming object

Public function Virtual Const

UWorld *

 

GetWorld()

Public function Const

const TSoftO...

 

GetWorldAsset()

Returns a constant reference to the world asset this streaming level object references

Public function Virtual Const

FName

 

GetWorldAssetPackageFName()

Gets the package name for the world asset referred to by this level streaming as an FName

Public function Const

FString

 

GetWorldAssetPackageName()

Gets the package name for the world asset referred to by this level streaming

Public function Const

bool

 

HasLoadedLevel()

Returns whether the streaming level has loaded a level.

Public function Const

bool

 

HasLoadRequestPending()

Returns whether the streaming level is in the loading state.

Public function Const

bool

 

IsLevelLoaded()

Returns whether streaming level is loaded

Public function Const

bool

 

IsLevelVisible()

Returns whether streaming level is visible

Public function Const

bool

 

IsStreamingStatePending()

Returns whether level has streaming state change pending

Public function Const

bool

 

IsValidStreamingLevel()

Returns false if the level package associated to that streaming level is invalid.

Protected function Virtual

void

 

OnLevelLoadedChanged

(
    ULevel* Level
)

Called by SetLoadedLevel

Protected function

void

 

PrepareLoadedLevel

(
    ULevel* InLevel,
    UPackage* InLevelPackage,
    int32 InPIEInstanceID
)

Sets loaded level, fixups for PIE, notifies level is loaded, apply necessary modifications on level once loaded.

Public function Static

void

 

RemoveLevelAnnotation

(
    const ULevel* Level
)

Public function

void

 

RemoveLevelFromCollectionForReload()

After a sub level is reloaded in the editor the cache state needs to be refreshed.

Public function

void

 

RemoveStreamingVolumeDuplicates()

Remove duplicates in EditorStreamingVolumes list

Public function

void

 

RenameForPIE

(
    int PIEInstanceID,
    bool bKeepWorldAssetName
)

Rename package name to PIE appropriate name

Protected function Virtual

bool

 

RequestLevel

(
    UWorld* PersistentWorld,
    bool bAllowLevelLoadRequests,
    EReqLevelBlock BlockPolicy
)

Try to find loaded level in memory, issue a loading request otherwise

Public function

void

 

SetFolderPath

(
    const FName& InFolderPath
)

Sets the folder path for this level in the world browser. Only available in editor builds

Public function

void

 

SetIsRequestingUnloadAndRemoval

(
    bool bInIsRequestingUnloadAndRemova...
)

Sets if the streaming level should be unloaded and removed.

Public function

void

 

SetLevelLODIndex

(
    int32 LODIndex
)

Sets the world composition level LOD index and marks the streaming level as requiring consideration.

Protected function Virtual

void

 

SetLoadedLevel

(
    ULevel* Level
)

Sets the value of LoadedLevel

Public function

void

 

SetPriority

(
    int32 NewPriority
)

Sets the relative priority of considering the streaming level.

Public function Virtual

void

 

SetShouldBeLoaded

(
    bool bInShouldBeLoaded
)

Virtual that can be overriden to change whether a streaming level should be loaded.

Public function

void

 

SetShouldBeVisible

(
    bool bInShouldBeVisible
)

Sets the should be visible flag and marks the streaming level as requiring consideration.

Public function

void

 

SetShouldBeVisibleInEditor

(
    bool bInShouldBeVisibleInEditor
)

Sets if the streaming level should be visible in the editor.

Public function Virtual

void

 

SetWorldAsset

(
    const TSoftObjectPtr< UWorld >& Ne...
)

Setter for WorldAsset.

Public function

void

 

SetWorldAssetByPackageName

(
    FName InPackageName
)

Sets the world asset based on the package name assuming it contains a world of the same name.

Public function Virtual Const

bool

 

ShouldBeAlwaysLoaded()

Public function Virtual Const

bool

 

ShouldBeLoaded()

Return whether this level should be present in memory which in turn tells the streaming code to stream it in.

Public function Virtual Const

bool

 

ShouldBeVisible()

Return whether this level should be visible/ associated with the world if it is loaded.

Public function Virtual Const

bool

 

ShouldRequireFullVisibilityToRender()

Returns whether level should start to render only when it will be fully added to the world or not.

Public function Virtual Const

bool

 

ShowInLevelCollection()

Returns if the streaming level is visible in LevelCollectionModel

Overridden from UObject

Name Description

Public function Virtual

void

 

PostEditChangeProperty

(
    FPropertyChangedEvent& PropertyCha...
)

Called when a property on this object has been modified externally

Public function Virtual

void

 

PostEditUndo()

Override Pre/PostEditUndo functions to handle editor transform

Public function Virtual

void

 

PostLoad()

Do any object-specific cleanup required immediately after loading an object.

Public function Virtual

void

 

Serialize

(
    FArchive& Ar
)

Handles reading, writing, and reference collecting using FArchive.

Classes

Name

Description

Public struct

FLevelAnnotation

Annotation for fast inverse lookup.

Public struct

FPackageNameMatcher

Matcher for searching streaming levels by PackageName

Enums

Constants

Name

Description

LevelAnnotations

Deprecated Variables

Name Description

Public variable

FColor

 

DrawColor_DEPRECATED

Deprecated level color used for visualization.

Public variable

FName

 

PackageName_DEPRECATED

Deprecated name of the package containing the level to load.