Hello! I’ve been following the BatteryCollector series from UE’S Website under the Learn tab and i’ve encountered many issues.One of them is the following:
On part 6 of the series at the end of the video, she Compiles the game from within the code using VS’s build function.However my build fails outputting this error:
UE4’s stack trace’s can be kind of cryptic especially when it comes errors in the Header files as you’ve seen - “Other Compilation Error(5)”
I’d recommend checking the “Output” tab of visual studio for more information on the error. If you could do that and upload that text here, I could probably help you out a bit more.
Hey there, thanks for helping me out.I’ll post my code below(both .cpp and .h) because I’ve already added what you said but that sadly didn’t help.
// Fill out your copyright notice in the Description page of Project Settings.
#include "BatteryCollector.h"
#include "Classes/Components/BoxComponent.h"
#include "SpawnVolume.h"
#include "Kismet/KismetMathLibrary.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;
// Create the box component to represent the spawn volume(area)
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::GetRandomPointInVolume()
{
FVector SpawnOrigin = WhereToSpawn->Bounds.Origin;
FVector SpawnExtent = WhereToSpawn->Bounds.BoxExtent;
return UKismetMathLibrary::RandomPointInBoundingBox(SpawnOrigin, SpawnExtent);
}
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "SpawnVolume.generated.h"
UCLASS()
class BATTERYCOLLECTOR_API ASpawnVolume : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ASpawnVolume();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
// Returns the wheretospawn subobject
FORCEINLINE class UBoxComponent* GetWhereToSpawn() const { return WhereToSpawn; }
// Find a random point within the BoxComponent
UFUNCTION(BlueprintPure,Category = "Spawning")
FVector GetRandomPointInVolume();
private:
// Box component to specify where pickups should be spawned
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Spawning", meta = (AllowPrivateAccess= "true"));
class UBoxComponent* WhereToSpawn;
};
Hopefully you can help me out again ! Thanks in advance.
I can’t find the problem. Can you do what arrpeatwo4 asks for or upload the project, so it’s easier for people to just go straight in without recreating the tutorial? <3