ClassPrivate
Is theUClass
of the object instance. The thing you get back when you callGetClass()
.- If a object was loaded from “a loader” (
FAsyncPackage
orLoadPackageInternal
) it will have theRF_WasLoaded
flag. This can be very useful to use on actors to know if they got loaded from disk or spawned at runtime. - UObject Construction & Post Initalization
Reflection
Since 5.5 TObjectPtr<>
is mandatory for UObject
variables (only for members of classes and structs). You still need to mark the variable with UPROPERTY()
or the UObject
ref will never be cleared.
See
There is also AddReferencedObjects
, for example this is used in AActor to add all owned components. (For UObjects only, otherwise look for AddReferencedObjectsGlobals
)
The GC will call this as much as it needs (TStrongObjectPtr
would be better performance wise in some cases).
To use
TStrongObjectPtr
you must include the type
Archetype
GetArchetype
gives you the template object that was used.
For example, the UObject you get from a BP editor sub object editor (with BlueprintEditor->GetSubobjectEditor()->GetDragDropTree()->GetSelectedItems()
) is the same than the returned archetype of the component that lives in the preview world.
GEN_VARIABLE
These objects are templates, meaning they aren’t owned by an actor component instance but by the supposed owning actor class (get it by using GetTypedOuter<UClass>()
)
Virtual functions details
-
PostTransacted
is called when you move/edit anything in a BP -
When you compile a BP,
PostInitProperties
,PostEditChangeProperty
andPostCDOContruct
are called. -
When you edit a property
PostEditChangeProperty
is called (Doesn’t work for Transforms) -
PostCDOContruct
always has its World null.
TStrongObjectPtr
Use MyStrPtr.Reset(SomeObject)
to set it.