How can I create an instance of a class without spawning it and take the default value for its atributes?
Situation:
I have a blueprint wich contain a array of:
UPROPERTY(EditDefaultsOnly, Category = Item)
TSubclassOf<class AItem> Item;
and im instantiating that blueprint in cpp:
static ConstructorHelpers::FObjectFinder<UBlueprint> ItemBDBlueprint(TEXT("Blueprint'/Game/Blueprints/Inventory/ItemDB.ItemDB'"));
if (ItemBDBlueprint.Succeeded())
{
GameItemDataBase = (UClass*)ItemBDBlueprint.Object->GeneratedClass;
ItemDB = GameItemDataBase->GetDefaultObject<AItemDataBase>();
}
Now i want to select some of the elements from “ItemDB” and add them to an “inventory” array.
What is the best way to instantiate some elements from ItemDB and add the references to an Inventory array?
//The Inventory
TArray<class AItem*> Inventory;
Similar question here without answer:
Sorry for my english and thanks