HI,
im trying to get the C++ battery tutorial work.
But I can’t figure out why I’m not able to use FActorSpawnParameters or World->…
What am I doing wrong?
It tells me: FactorSpawnParameters is undefined or pointer to incomplete class type is not allowed (for World->).
#include "SpawnVolume.h"
#include "Components/BoxComponent.h"
#include "Kismet/KismetMathLibrary.h"
#include "Pickup.h"
// Sets default values
ASpawnVolume::ASpawnVolume()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = false;
WhereToSpawn = CreateDefaultSubobject<UBoxComponent>(TEXT("WhereToSpawn"));
RootComponent = WhereToSpawn;
}
// Called when the game starts or when spawned
void ASpawnVolume::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ASpawnVolume::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
FVector ASpawnVolume::GetRandomPositionInVolume() {
FVector SpawnOrigin = WhereToSpawn->Bounds.Origin;
FVector SPawnExtent = WhereToSpawn->Bounds.BoxExtent;
return UKismetMathLibrary::RandomPointInBoundingBox(SpawnOrigin, SPawnExtent);
}
void ASpawnVolume::SpawnPickup() {
if (WhatToSpawn != NULL) {
const UWorld* World = GetWorld();
if (World) {
FActorSpawnParameters SpawnParams; //IS UNDEFINED
}
}
}