FObjectFinder vs LoadObject

Arty McLabin
Sun, 18 Mar 2018 22:36:46 +0000
Character & Animation

Let’s collect the differences between the two methods, as they don’t seem to be mentioned anywhere else.

FObjectFinder is used in constructor, while LoadObject is used anywhere
2.
Syntax difference:

UMaterial* material_var = LoadObject<UMaterial>(nullptr,TEXT("Material'/Game/...'"));
//vs
static ConstructorHelpers::FObjectFinder<UMaterial> material_wrapped(TEXT("Material'/Game/...'"));
UMaterial* material_var = material_wrapped.Object;

3.
FObjectFinder creates a static var in C++ constructor which wastes sizeof(*ptr) of RAM per class for each time you use that method

I will add more differences as i discover them either myself or hear them here.

one particularly interesting is how slower is LoadObject compared to FObjectFinder?

10 posts - 1 participant