I’m trying to give my character class a skeletal mesh but am unclear how FObjectFinder works. I have 2 questions.
- What should the path argument be, and what is it relative to?
For instance -
// Absolute path to asset file
E:/Unreal/Projects/FPSProject/Content/Models/SK_Mannequin.uasset
// Absolute path to class .cpp source file
E:/Unreal/Projects/FPSProject/Source/FPSProject/FPSCharacter.cpp
If I make this call from FPSCharacter.cpp …
static ConstructorHelpers::FObjectFinder<USkeletalMesh>
NewMesh(TEXT("/FPSProject/Content/Models/SK_Mannequin.uasset"));
… Will the directory “/FPSProject” be evaluated as
E:/Unreal/Projects/FPSProject/Source/FPSProject/
or
E:/Unreal/Projects/FPSProject/
- What is the prefix of the path in FObjectFinder’s argument?
In the following code, the argument is “StaticMesh’/Game/StarterContent/Props/MaterialSphere.MaterialSphere’”
What is “StaticMesh” in that argument?
static ConstructorHelpers::FObjectFinder<UStaticMesh>
BaseMeshAsset(TEXT("StaticMesh'/Game/StarterContent/Props/MaterialSphere.MaterialSphere'"));
Is it a class type, a file name, a directory?
What happens if you exclude it?
I’ve been stuck on this for a while, so any help would be appreciated.
Also any examples and explanations of how to use FObjectFinder, and how it works, would be very helpful.
Thanks!