• ClassPrivate Is the UClass of the object instance. The thing you get back when you call GetClass().
  • If a object was loaded from “a loader” (FAsyncPackage or LoadPackageInternal) it will have the RF_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

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

  • Actor Load/Init Function Cheatsheet

  • PostTransacted is called when you move/edit anything in a BP

  • When you compile a BP, PostInitProperties, PostEditChangeProperty and PostCDOContruct are called.

  • When you edit a property PostEditChangeProperty is called (Doesn’t work for Transforms)

  • PostCDOContruct always has its World null.

Managing off game thread

Thanks Hojo and Blue Man

  • creating UObjects off game thread is completely fine
  • you will need to manually remove the Async flag from it, once you’re ready for it to be managed by GC.
  • you can read and edit UObjects just fine wherever you want, within the confines of your own ability to safely code things async.

You can create new actor components off the game thread but it’s a minefield as each sub component class has various behavior. You will also have to rename the component’s outer once you get the component back on game thread because it has to be its owning actor (you cant directly use an actor ref as outer in the worker thread because this would edit the actor component list, which you shouldnt do).