The situation is i have been trying to compile a class that inherits from a custom pawn class.
The .h File:
#pragma once
#include "CoreMinimal.h"
#include "BasePawn.h"
#include "Tank.generated.h"
/**
*
*/
UCLASS()
class TOONTANKS_API ATank : public ABasePawn
{
GENERATED_BODY()
public:
ATank();
private:
UPROPERTY(EditAnywhere)
class USpringArmComponent* SpringArm;
UPROPERTY(EditAnywhere)
float Speed = 200.0f;
};
The .cpp file:
#include "Tank.h"
#include "GameFramework/SpringArmComponent.h"
#include "Camera/CameraComponent.h"
ATank::ATank()
{
SpringArm->CreateDefaultSubobject<USpringArmComponent>(TEXT("Spring"));
SpringArm->SetupAttachment(RootComponent);
}
The crash report shows:
Fatal error: [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/CoreUObject/Private/UObject/Obj.cpp] [Line: 114] Using incorrect object initializer.
UE4Editor_CoreUObject
UE4Editor_ToonTanks!ATank::ATank() [C:\1.) D. GAMEDEV Folder\Unreal Engine Projects\ToonTanksProjectSetup_4.25\ToonTanksProjectSetup_4.25\ToonTanks\Source\ToonTanks\Tank.cpp:11]
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_Core
UE4Editor_Core
UE4Editor_Projects
UE4Editor_Projects
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
kernel32
ntdll
Im not sure what im doing wrong. im sure my syntax is correct. If anyone posts to assist, i’ll try to respond asap
Thanks in advance!