I’m creating an NotPlacable Inventory class that derives from AActor and i want my custom ACharacter to have an instance of that class. Since it’s an actor i tried to to spawn it on PostInitializeComponents() using:
FActorSpawnParameters SpawnInfo;
SpawnInfo.bNoCollisionFail = true;
Inventory = GetWorld()->SpawnActor<AInventory>(AInventory::StaticClass(), SpawnInfo);
That’s giving me NULL. O also tried (don’t know exactly what this does, saw it online):
Inventory = AInventory::StaticClass()->GetDefaultObject<AInventory>();
But it’s still giving me NULL. Do you know what i am doing wrong? I’m assuming that on Unreal Engine we’re not supposed to instantiate AActor custom classes with new or mallocs, so i don’t see other options other than the one’s i’ve mentioned.