x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Product Version: UE 4.12
Tags:
more ▼

asked Jul 13 '16 at 01:38 PM in C++ Programming

avatar image

AlexHonor
13 1 2 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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"));

more ▼

answered Jul 13 '16 at 01:52 PM

avatar image

ImVawx ♦♦ STAFF
6.8k 114 17 127

avatar image AlexHonor Jul 13 '16 at 02:39 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question