So this is me coming from a background with Unity3D and C#/.NET. I am trying to port over some code of a project and I noticed that I have this terrible habit of using constructors and overloading them a few times. Trying to do almost the same thing does not appear to want to work, mostly due to the framework of the engine from what I can tell.
The default constructor in the .cpp file I left alone, but trying to make another constructor right below it didn’t work for me like it normally would in C#. Let’s say for example I was trying to make a circle:
//Circle.h
#include "GameFramework/Actor.h"
#include "UnrealMathUtility.h"
#include "Circle.generated.h"
UCLASS()
class ACircle : public AActor
{
GENERATED_UCLASS_BODY()
public:
UPROPERTY()
FVector Focus;
UPROPERTY()
float radius;
};
//Circle.cpp
#include "UnrealTeralta.h"
#include "Circle.h"
ACircle::ACircle(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
}
ACircle::ACircle(FVector Position, float radiusLength)
{
Focus = Position;
radius = radiusLength;
}
Attempting to do this circle even doesn’t work for me. I owe it up to my complete unfamiliarity with the engine and slight unfamiliarity with C++. I’m wondering if even what I’m trying to do is appropriate for using the Unreal macros.
For the curious, my purpose is not to “spawn” these objects in the editor (as most of these questions seem to want to do), just set the data up with the actor ready to be spawned in at a moment’s notice. I appreciate your patience with me.