Hey there.I have been following the BatteryCollector tutorials from the LEARN tab of the UE’S website but I’ve come across a problem.On part 5 in BatteryPickup.cpp (look below) :
// Fill out your copyright notice in the Description page of Project Settings.
#include "BatteryCollector.h"
#include "BatteryCollector\Pickup.h"
#include "BatteryPickup.h"
// set default values
ABatteryPickup::ABatteryPickup()
{
GetMesh()->SetSimulatePhysics(true); // when the batteries spawn in, they will fall from the sky
}
the GetMesh line throws this error : pointer to incomplete class type is not allowed.I tried solving it but nothing.And here is the Pickup.h script that contains the GetMesh function :
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Pickup.generated.h"
UCLASS()
class BATTERYCOLLECTOR_API APickup : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
APickup();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
// Return the mesh for the pickup
FORCEINLINE class UStaticMeshComponent* GetMesh() const { return PickupMesh; }
// Return whether or not the pickup is active
UFUNCTION(BlueprintPure,Category = "Pickup")
bool IsActive();
// Allows other classes to safely change whether or not the pickup is active
UFUNCTION(BlueprintCallable, Category = "Pickup")
void SetActive(bool NewPickupState);
protected: // protected = this can be changed only through this script,through BPS or through another script based on this one
// True when the pickup can be used and false when the pickup is deactivated
bool bIsActive;
private:
// Static mesh to represent the pickup in the level
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Pickup", meta = (AllowPrivateAccess = "true"))
class UStaticMeshComponent* PickupMesh;
};
Any ideas?