I’m having an issue where it wont accept the object declaration from my class. I want to get a variable from it, but it gives me this error.
1>c:\users\chadalak\documents\unreal projects\sidescrollerconcept\source\sidescrollerconcept
atureability.cpp(22): error C2220: warning treated as error - no 'object' file generated
1>c:\users\chadalak\documents\unreal projects\sidescrollerconcept\source\sidescrollerconcept
atureability.cpp(22): warning C4700: uninitialized local variable 'SizeCheck' used
Maybe I’m declaring the object wrong? Here’s my code
.cpp
#include "SideScrollerConcept.h"
#include "NatureAbility.h"
#include "ParticleDefinitions.h"
#include "SideScrollerConceptCharacter.h"
ANatureAbility::ANatureAbility(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
ProjectileMovement = PCIP.CreateDefaultSubobject<UProjectileMovementComponent>(this, TEXT("ProjectileComp"));
ProjectileMovement->InitialSpeed = 3000.0f;
ProjectileMovement->MaxSpeed = 3000.0f;
ProjectileMovement->bRotationFollowsVelocity = true;
ProjectileMovement->bShouldBounce = true;
ProjectileMovement->Bounciness = 0.3f;
NatureScale = PCIP.CreateDefaultSubobject<UParticleSystemComponent>(this, TEXT("NatureScale"));
ASideScrollerConceptCharacter *SizeCheck;
NatureScale->SetRelativeScale3D(FVector(SizeCheck->ChargeAmount, SizeCheck->ChargeAmount, SizeCheck->ChargeAmount));
}
.h
#pragma once
#include "GameFramework/Actor.h"
#include "NatureAbility.generated.h"
/**
*
*/
UCLASS()
class ANatureAbility : public AActor
{
GENERATED_UCLASS_BODY()
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Movement)
TSubobjectPtr<class UProjectileMovementComponent> ProjectileMovement;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Movement)
TSubobjectPtr<class UParticleSystemComponent> NatureScale;
};