This relates to C++ and blueprints, though I believe this relates more to C++.
So this is Class setup
Actor is the Highest level/ Master Parent
Inventory_BP class is a child to Actor class, InventorySubSections_BP class is a child to Inventory_BP class etc.
I created a blueprint node via the following code, using a Blueprint Function Library (Full credit to and permission from florianbepunkt, original source code: https://forums.unrealengine.com/deve…ut-the-classes - bottom post )
(Public)
CustomNodesPublicHeader.h
#pragma once
#include "Kismet/BlueprintFunctionLibrary.h"
#include "CustomNodesPublicHeader.generated.h"
/**
*
*/
UCLASS()
class ARPG_V1_API UCustomNodesPublicHeader : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get Child Classes", Keywords = "Get Child Classes"), Category = Class)
static TArray<UClass*> GetClasses(UClass* ParentClass);
};
It works perfectly ONLY if I open up each child blueprint before running the node. Note, this node was developed on an older version.
The below custom node is tided to the inventory_BP actor placed in the map.
(Private)
CustomNodesPublicHeader.cpp
#include "CustomNodesPublicHeader.h"
#include "ARPG_v1.h" //‘ARPG_v1.h’ is my game project’s header file
TArray<UClass*> UCustomNodesPublicHeader::GetClasses(UClass* ParentClass)
{
TArray<UClass*> Results;
// get our parent blueprint class
const FString ParentClassName = ParentClass->GetName();
UObject* ClassPackage = ANY_PACKAGE;
UClass* ParentBPClass = FindObject<UClass>(ClassPackage, *ParentClassName);
// iterate over UClass, this might be heavy on performance, so keep in mind..
// better suggestions for a check are welcome
for (TObjectIterator<UClass> It; It; ++It)
{
if (It->IsChildOf(ParentBPClass))
{
// It is a child of the Parent Class
//make sure we don't include our parent class in the array (weak name check, suggestions welcome)
if (It->GetName() != ParentClassName)
{
Results.Add(*It);
}
}
}
return Results;
It works perfectly ONLY if I open up each child blueprint before running the node. Note, this node was developed on an older version of UE4.
The below custom node is tided to the inventory_BP actor placed in the map.
Before opening Children blueprints of ‘QuestItems_BP’. No Child classes detectedAfter opening Children blueprints of ‘QuestItems_BP’, Working as expected
Any ideas as to why this is happening, why are the child blueprints classes not loading in at all instances, is it because they have yet to be ‘loaded into memory’?
Is there anyway of loading my inventory blueprints ‘into memory’ on games launch?