I have build a class in Unreal called Groundmode
GroundMode.h:
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "Components/BoxComponent.h"
#include <NMR\GroundDirection.h>
#include "GroundMode.generated.h"
UCLASS()
class NMR_API UGroundMode : public UObject
{
GENERATED_BODY()
public:
UGroundMode();
};
GroundMode.cpp:
#include "GroundMode.h"
UGroundMode::UGroundMode() {}
I want to be able to instantiate this class in another class.
PlayerPhysicsCollisionInfo.h
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "GroundMode.h"
#include "PlayerPhysicsCollisionInfo.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class NMR_API UPlayerPhysicsCollisionInfo : public UActorComponent
{
GENERATED_BODY()
public:
UPlayerPhysicsCollisionInfo();
UGroundMode downMode;
UGroundMode upMode;
UGroundMode leftMode;
UGroundMode rightMode;
};
PlayerPhysicsCollisionInfo.cpp:
#include “PlayerPhysicsCollisionInfo.h”
void UPlayerPhysicsCollisionInfo::BeginPlay()
{
Super::BeginPlay();
downMode = new UGroundMode();
upMode = new UGroundMode();
leftMode = new UGroundMode();
rightMode = new UGroundMode();
}
When I attempt to create instances of UGroundMode with the new keyword I get the following compile error:
D:\Documents\Unreal Projects\NMR\Source\NMR\PlayerPhysicsCollisionInfo.cpp(25) : error C2661: ‘UGroundMode::operator new’: no overloaded function takes 1 arguments
What am I doing wrong? The constructor takes no arguments not 1.