How to make a blueprint class always load?

Hi there, I have a strange problem. Some of my blueprint classes don’t seem to load after the app is started.

My app is a building editor containing a range of building components you can use to construct e.g. a house. Each component is a blueprint based on my blueprint class called “Placeable”. Originally, I was loading these “Placeable” child blueprints from an array I had stored in my GameMode class. On BeginPlay the game mode has iterated over this array and has instantiated the child blueprints and displayed them in the app’s building menu as buttons.

After adding tens of components to the array, I found it too repetitive and so I made a custom node in C++ that collects a list of Placeable subclasses for me:

Screenshot_6.png

Now if I start the game, this node doesn’t seem to collect all subclasses of “Placeable”, only a few ones. If I want the rest of the subclasses to appear, I need to locate them in the Content Browser, right-click them and select Asset Actions > Reload. Once this action is done and I start the app, the selected blueprint subclasses appear.



TArray<UClass*> UConstructFunctionLibrary::GetChildClasses(UClass* ParentClass)
{
  TArray<UClass*> Results;

  const FString ParentClassName = ParentClass->GetName();
  UObject* ClassPackage = ANY_PACKAGE;
  UClass* ParentBPClass = FindObject<UClass>(ClassPackage, *ParentClassName);

  for (TObjectIterator<UClass> It; It; ++It)
  {
    if (It->IsChildOf(ParentBPClass))
    {
      if (It->GetName() != ParentClassName)
      {
        Results.Add(*It);
      }
    }
  }

return Results;
}


I suspect that for some reason some subclasses don’t get loaded, because there is no reference to them in other loaded blueprints. Is there any way to make selected blueprint classes always load?

I’ve just found out that another way I can make the classes appear in runtime is select the folder which contains my subclasses, right-click and select audit asssts, which gives me the below dialog where I can select all the blueprints and chose “Load…”.

This guy seem to have faced a similar problem, not sure how to put together the C++ yet, I’ll post here if I manage to find a solution.