I am fairly new to both Unreal and C++.
I have only dabbled in both.
I’ve started going through Unreal’s programming tutorials…
Anyway, I am trying to make a struct, and simple struct… It’s not a complex concept. It’s a struct.
Most forum threads crying woefully over structs seem to point to this page at some point, which I am using for reference.
However I write it, I get an Error.
Here is the struct,
It is declared in a “None” C++ class created via Unreal.
#pragma once
#include "CoreMinimal.h"
#include "Engine.h"
USTRUCT([Atomic])
struct PRACTICEPROJECT_API FCameraChangeData
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere)
AActor* Camera;
UPROPERTY(EditAnywhere)
float BlendTime;
UPROPERTY(EditAnywhere)
float TimeToNextCameraChange;
FCameraChangeData()
{
Camera = NULL;
BlendTime = 0.0f;
TimeToNextCameraChange = 0.0f;
}
};
The above gets*(Line 9 - USTRUCT([Atomic]))*** Error: Missing ‘,’ in Struct declaration specifier**
replacing
USTRUCT([Atomic])
with
USTRUCT(Atomic)
returns **error C4430: missing type specifier (etc…) **so that is obviously a bad idea.
Using
GENERATED_USTRUCT_BODY()
as instructed in the Unreal Documentation returns **Error: Missing ‘,’ in Struct declaration specifier **also
which is kinda why I have mostly been using
GENERATED_BODY()
So, I thought I’ll just comment out the GENERATED_BODY() and Unreal gives me:
Error: Expected a GENERATED_BODY() at the start of struct
All Errors seem to point to my Specifiers (which I have also tested between the brackets of the GENERATED_BODY() line) but at my GENERATED_BODY() line
I have googled wildly trying to see how other people write their structs, to see what I am doing wrong but to no avail.
Can any better person out there help me?