Hey guys!
I’m wondering what is the correct way to spawn actor of child class and get pointer to parent class.
.h
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Gun)
class TSubclassOf<class ABaseWeapon> gunClass;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Gun)
class ABaseWeapon * gun;
And here is .cpp
const FVector spawnLocation = GetMesh()->GetSocketLocation("RightHand");
const FRotator spawnRotation = GetMesh()->GetSocketRotation("RightHand");
const FActorSpawnParameters spawnParams;
gun = GetWorld()->SpawnActor<ABaseWeapon>(gunClass, spawnLocation, spawnRotation, spawnParams);
But I’m still getting exceptions. Any help?