What is the right syntax of FClassFinder and how could I generaly use it to find a specific blueprint?

What is the right syntax of FClassFinder and how could I generally use it to find a specific blueprint? I have read a ton of information and couldn’t find explanation of syntax or any useful reference. Preferably I would like to know how to find all child classes of an abstract C++ class( which themselves would be Blueprints ).
Example of usage I found ( And my guesses )

static ConstructorHelpers::FClassFinder VarIGetIt(TEXT("BlueprintIWantToFind'/Content/StaticMeshes/Meshes/Ship/BlueprintIWantToFind.BlueprintIWantToFind_C'"));
if (VarIGetIt.Class != NULL)
{
	ClassIsHereNow = VarIGetIt.Class;
}

Thank you in advance.

P.S. Would be glad if someone would point me at a good source about UClass and general class management of classes in Unreal.

2 Likes

Hey AlexHonor,

An example of FClass finder can be found when you want to assign a Game Modes default classes types, such as:

AFPSCPPGameMode::AFPSCPPGameMode() : Super()
{
	static ConstructorHelpers::FClassFinder<APawn> PawnClassAsset(TEXT("/Game/FirstPersonCPP/Blueprints/FirstPersonCharacter"));
	if(PawnClassAsset.Succeeded( ))
	{
		DefaultPawnClass = PawnClassAsset.Class;
	}

	static ConstructorHelpers::FClassFinder<APlayerController> ControllerClassAsset( TEXT("/Game/FirstPersonCPP/Blueprints/FPSCPPController_BP") );
	if (ControllerClassAsset.Succeeded( ))
	{
		PlayerControllerClass = ControllerClassAsset.Class;
	}

	HUDClass = AFPSCPPHUD::StaticClass();
}

To break it down further:

FClassFinder is going to give you a class back. The type of the class follows FClassFinder, such as:

static ConstructorHelpers::FClassFinder or static ConstructorHelpers::FClassFinder.

Then you need to declare a variable for the return, such as:

static ConstructorHelpers::FClassFinder PawnClassAsset

After that, you need to give the path to the asset, in the Content folder, such as:

static ConstructorHelpers::FClassFinder PawnClassAsset(TEXT(“/Game/FirstPersonCPP/Blueprints/FirstPersonCharacter”));

2 Likes

Finally, It works. Thank you for your answer. It is pretty much what I have wanted to hear, but an important note has to be made. If somebody is still interested. Search path that is provided is not a common search path, but a weird one starting with “/Game/” and further the path relative to Content folder itself. You can see it in a hint if you stick your mouse over a blueprint for a while.

1 Like