UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
LightWeightInstanceSubsystem.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
9
10
12
14
16{
25
28
29 // Returns the instance manager that handles the given handle
31
32 // Returns the instance manager that handles actors of type ActorClass in level Level
33 UE_DEPRECATED(5.3, "Use the version that takes in a position.")
34 ENGINE_API ALightWeightInstanceManager* FindLightWeightInstanceManager(UClass* ActorClass, const UDataLayerInstance* Layer, UWorld* World) const;
35
36 // Returns the instance manager that handles instances of type Class that live in Level
37 UE_DEPRECATED(5.3, "Use the version that takes in a position.")
38 ENGINE_API ALightWeightInstanceManager* FindOrAddLightWeightInstanceManager(UClass* ActorClass, const UDataLayerInstance* DataLayer, UWorld* World);
39
40 // Returns the instance manager that handles actors of type ActorClass in level Level
41 ENGINE_API ALightWeightInstanceManager* FindLightWeightInstanceManager(UClass& ActorClass, UWorld& World, const FVector& InPos, const UDataLayerInstance* DataLayer = nullptr) const;
42
43 // Returns the instance manager that handles instances of type Class that live in Level
44 ENGINE_API ALightWeightInstanceManager* FindOrAddLightWeightInstanceManager(UClass& ActorClass, UWorld& World, const FVector& InPos, const UDataLayerInstance* DataLayer = nullptr);
45
46 // Returns the actor specified by Handle if it exists. Returns nullptr if it doesn't
48
49 // Returns the class of the actor specified by Handle.
51
53
55
57
58 // Returns true if the object represented by Handle is in InLevel
60
61 // Returns a handle to a new light weight instance that represents an object of type ActorClass
62 ENGINE_API FActorInstanceHandle CreateNewLightWeightInstance(UClass* ActorClass, FLWIData* InitData, UDataLayerInstance* Layer, UWorld* World);
63
64 // deletes the instance identified by Handle
66
67 // Helper that converts a position (world space) into a coordinate for the LWI grid.
68 UE_DEPRECATED(5.3, "Use LWI Managers version of ConvertPositionToCoord()")
70
71 // Add a manager to the subsystem, thread safe.
73
74 // Remove a manager from the subsystem, thread safe.
76
78 // Returns the class of the instance manager best suited to support instances of type ActorClass
80
81 // Returns the index associated with Manager
83
84 // Returns the light weight instance manager at index Index
86
88 // TODO: preallocate the size of this based on a config variable
89 TArray<ALightWeightInstanceManager*> LWInstanceManagers;
90
91 // Mutex to make sure we don't change the LWInstanceManagers array while reading/writing it.
92 mutable FTransactionallySafeRWLock LWIManagersRWLock;
93
94#ifdef WITH_EDITOR
95private:
98#endif // WITH_EDITOR
99};
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
SharedPointerInternals::TRawPtrProxy< ObjectType > MakeShareable(ObjectType *InObject)
Definition SharedPointer.h:1947
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_LOG_CATEGORY_EXTERN(CategoryName, DefaultVerbosity, CompileTimeVerbosity)
Definition LogMacros.h:361
Definition Actor.h:257
Definition LightWeightInstanceManager.h:32
Definition IConsoleManager.h:1580
Definition IDelegateInstance.h:14
Definition Array.h:670
Definition SharedPointer.h:692
Definition Class.h:3793
Definition CriticalSection.h:14
Definition Level.h:423
Definition World.h:918
U16 Index
Definition radfft.cpp:71
Definition ActorInstanceHandle.h:33
Definition LightWeightInstanceManager.h:25
Definition LightWeightInstanceSubsystem.h:16
ENGINE_API bool RemoveManager(ALightWeightInstanceManager *Manager)
Definition LightWeightInstanceSubsystem.cpp:71
ENGINE_API ALightWeightInstanceManager * FindLightWeightInstanceManager(const FActorInstanceHandle &Handle) const
Definition LightWeightInstanceSubsystem.cpp:77
ENGINE_API ULevel * GetLevel(const FActorInstanceHandle &Handle)
Definition LightWeightInstanceSubsystem.cpp:325
ENGINE_API int32 GetManagerIndex(const ALightWeightInstanceManager *Manager) const
Definition LightWeightInstanceSubsystem.cpp:45
ENGINE_API AActor * GetActor_NoCreate(const FActorInstanceHandle &Handle) const
Definition LightWeightInstanceSubsystem.cpp:271
ENGINE_API FVector GetLocation(const FActorInstanceHandle &Handle)
Definition LightWeightInstanceSubsystem.cpp:291
ENGINE_API ALightWeightInstanceManager * FindOrAddLightWeightInstanceManager(UClass *ActorClass, const UDataLayerInstance *DataLayer, UWorld *World)
Definition LightWeightInstanceSubsystem.cpp:127
ENGINE_API FString GetName(const FActorInstanceHandle &Handle)
Definition LightWeightInstanceSubsystem.cpp:308
ENGINE_API FLightWeightInstanceSubsystem()
Definition LightWeightInstanceSubsystem.cpp:11
ENGINE_API UClass * FindBestInstanceManagerClass(const UClass *ActorClass)
Definition LightWeightInstanceSubsystem.cpp:217
ENGINE_API void DeleteInstance(const FActorInstanceHandle &Handle)
Definition LightWeightInstanceSubsystem.cpp:376
ENGINE_API FActorInstanceHandle CreateNewLightWeightInstance(UClass *ActorClass, FLWIData *InitData, UDataLayerInstance *Layer, UWorld *World)
Definition LightWeightInstanceSubsystem.cpp:359
ENGINE_API const ALightWeightInstanceManager * GetManagerAt(int32 Index) const
Definition LightWeightInstanceSubsystem.cpp:59
ENGINE_API ~FLightWeightInstanceSubsystem()
Definition LightWeightInstanceSubsystem.cpp:34
ENGINE_API bool AddManager(ALightWeightInstanceManager *Manager)
Definition LightWeightInstanceSubsystem.cpp:65
static ENGINE_API FInt32Vector3 ConvertPositionToCoord(const FVector &InPosition)
ENGINE_API UClass * GetActorClass(const FActorInstanceHandle &Handle)
Definition LightWeightInstanceSubsystem.cpp:276
static FLightWeightInstanceSubsystem & Get()
Definition LightWeightInstanceSubsystem.h:17
ENGINE_API bool IsInLevel(const FActorInstanceHandle &Handle, const ULevel *InLevel)
Definition LightWeightInstanceSubsystem.cpp:342