ALightWeightInstanceManager

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/GameFramework/LightWeightInstanceManager.h

Include

#include "GameFramework/LightWeightInstanceManager.h"

Syntax

class ALightWeightInstanceManager : public AActor

Variables

Name Description

Protected variable

TSubclassOf< AA...

 

AcceptedClass

Protected variable

TMap< int32, AA...

 

Actors

Keep track of which instances are currently represented by an actor

Protected variable

FString

 

BaseInstanceName

Protected variable

TArray< int32 >

 

FreeIndices

List of indices that we are no longer using

Protected variable

TArray< FTransf...

 

InstanceTransforms

Current per instance transforms.

Protected variable

TSubclassOf< AA...

 

RepresentedClass

Protected variable

TArray< bool >

 

ValidIndices

Handy way to check indices quickly so we don't need to iterate through the free indices list

Constructors

Name Description

Public function

ALightWeightInstanceManager

(
    const FObjectInitializer& ObjectIn...
)

Destructors

Functions

Name Description

Protected function

int32

 

AddNewInstance

(
    FLWIData* InitData
)

Takes a polymorphic struct to set the initial data for a new instance.

Protected function Virtual

void

 

AddNewInstanceAt

(
    FLWIData* InitData,
    int32 Index
)

Adds a new instance at the specified index.

Protected function Virtual Const

FLWIData ...

 

AllocateInitData()

Allocates the appropriate subclass of FLWIData to initialize instances for this manager. The caller is responsible for freeing the memory when they are finished.

Public function

FActorInstan...

 

ConvertActorToLightWeightInstance

(
    AActor* InActor
)

Returns a handle to a light weight instance representing the same object as InActor and calls destroy on InActor if successful.

Public function Virtual Const

int32

 

ConvertCollisionIndexToLightWeightIndex

(
    int32 InIndex
)

Returns the index used internally by the light weight instance manager that is associated with the instance referred to by InIndex used by collision and rendering.

Protected function Virtual Const

int32

 

ConvertHandleIndexToInternalIndex

(
    int32 InHandleIndex
)

Protected function

AActor *

 

ConvertInstanceToActor

(
    const FActorInstanceHandle& Handle
)

Creates an actor to replace the instance specified by Handle.

Protected function Virtual Const

int32

 

ConvertInternalIndexToHandleIndex

(
    int32 InInternalIndex
)

Helper functions for converting between our internal storage indices and the indices used by external bookkeeping.

Public function Virtual Const

int32

 

ConvertLightWeightIndexToCollisionIndex

(
    int32 InIndex
)

Returns the index used by collision and rendering that is associated with the instance referred to by InIndex.

Protected function

UObject *...

 

CreateInterfaceObject

(
    const FActorInstanceHandle& Handle
)

Create an object that implements interfaces for the light weight instance specified by Handle.

Public function Const

bool

 

DoesAcceptClass

(
    const UClass* OtherClass
)

Returns true if this manager is capable of representing objects of type OtherClass.

Public function Const

bool

 

DoesRepresentClass

(
    const UClass* OtherClass
)

Returns true if this manager stores instances that can be turned into full weight objects of class OtherClass.

Public function

AActor *

 

FetchActorFromHandle

(
    const FActorInstanceHandle& Handle
)

Returns the actor associated with Handle if one exists.

Public function

I *

 

FetchInterfaceObject

(
    const FActorInstanceHandle& Handle
)

Protected function Const

bool

 

FindActorForHandle

(
    const FActorInstanceHandle& Handle
)

Checks if we already have an actor for this handle. If an actor already exists we set the Actor variable on Handle and return true.

Public function Const

int32

 

FindIndexForActor

(
    const AActor* InActor
)

Returns the index of the light weight instance associated with InActor if one exists; otherwise we return INDEX_NONE.

Public function Const

UClass *

 

GetAcceptedClass()

Returns the base class of types that this can manage.

Protected function Virtual Const

UClass *

 

GetActorClassToSpawn

(
    const FActorInstanceHandle& Handle
)

Returns the class to use when spawning a new actor.

Protected function Virtual Const

UClass *

 

GetInterfaceClass()

Gets the class that implements interfaces for light weight instances owned by this manager.

Public function Const

FVector

 

GetLocation

(
    const FActorInstanceHandle& Handle
)

Returns the location of the instance specified by Handle.

Public function Const

FString

 

GetName

(
    const FActorInstanceHandle& Handle
)

Returns the name of the instance specified by Handle.

Public function Const

UClass *

 

GetRepresentedClass()

Returns the specific class that this manages.

Public function Const

FRotator

 

GetRotation

(
    const FActorInstanceHandle& Handle
)

Returns the rotation of the instance specified by Handle.

Public function Const

FTransform

 

GetTransform

(
    const FActorInstanceHandle& Handle
)

Returns the transform of the instance specified by Handle.

Protected function Virtual

void

 

GrowDataArrays()

Increases the size of all of our data arrays to NewSize.

Protected function Const

bool

 

IsIndexValid

(
    int32 Index
)

Returns true if we have current information for an instance at Index.

Public function Const

bool

 

IsInterfaceSupported()

Protected function Virtual

void

 

OnRep_Transforms()

Protected function Virtual

void

 

PostActorSpawn

(
    const FActorInstanceHandle& Handle
)

Called after spawning a new actor from a light weight instance.

Protected function Virtual

void

 

RemoveInstance

(
    int32 Index
)

Removes the instance.

Protected function Virtual Const

bool

 

SetDataFromActor

(
    FLWIData* InData,
    AActor* InActor
)

Gathers info from InActor and stores it in InData. Returns true if the relevant data was successfully copied.

Public function Virtual

void

 

SetRepresentedClass

(
    UClass* ActorClass
)

Sets the specific class that this manages.

Protected function Virtual

void

 

SetSpawnParameters

(
    FActorSpawnParameters& SpawnParams
)

Sets the parameters for actor spawning.

Protected function Virtual

void

 

UpdateDataAtIndex

(
    FLWIData* InData,
    int32 Index
)

Populates the data array entries at Index with the data stored in InData;.

Overridden from AActor

Name Description

Public function Virtual

void

 

Tick

(
    float DeltaSeconds
)

Function called every frame on this Actor.

Overridden from UObject

Name Description

Public function Virtual Const

void

 

GetLifetimeReplicatedProps

(
    TArray< FLifetimeProperty >& OutLi...
)

Data and replication functions

Protected function Virtual

void

 

PostEditChangeProperty

(
    FPropertyChangedEvent& PropertyCha...
)

Editor functions