I am trying to create a new instance of a class in my scene. I instantiate an actor based on a blueprint, then try to cast it to the corresponding class. When I compile the solution, my editor crashes. Anyone know why this could be?
// Item that is used for empty slots in the inventory - makes it easier to switch between item slots and allows for more customisation by the designer UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Inventory", Meta = (AllowPrivateAccess = "true")) TSubclassOf<class ACollectableObject> EmptySlotClass; ACollectableObject* EmptySlot = nullptr; // In cpp... // Spawn an empty slot actor into the world, so that we can reference it EmptySlot = Cast<ACollectableObject>(this->GetWorld()->SpawnActor(EmptySlotClass));
ACollectableObject is derived from AActor base class. Thank you in advance!