Can't include "LevelSequence.h" because of "GENERATE_BODY()"

I want to include “LevelSequence.h” but it doesnt work cause of a GNERATE_BODY(). According to my research this is a common mistake over the years. Seems to be cause of the Line in which #includeX.generated.h and GENERATE_BODY are written, but I couldnt fix it

Here my Code:
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

include “CoreMinimal.h”
include “GameFramework/Pawn.h”
include “MainController.generated.h”
include “LevelSequence.h”

UCLASS()
class WF_API AMainController : public APawn
{
GENERATED_BODY()

public:
// Sets default values for this pawn’s properties
AMainController();

protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;

public:
// Called every frame
virtual void Tick(float DeltaTime) override;

// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

private:

UPROPERTY(VisibleAnywhere)
class UCameraComponent* Camera;

//UPROPERTY(EditEverywhere)
//class ULevelSequence* StartSequence;

void OnLeftMouseClick();
void PlayStartSequence();

};

Hi,

May you be great. Welcome to the forum.

So the problem is your #include ‘position’, I mean the last include have to be .generated.h, which means if you want to include any you must add before that.

In other words:

#pragma once

#include “CoreMinimal.h”
#include “GameFramework/Pawn.h”
#include “LevelSequence.h”
#include “MainController.generated.h”

// Remain code goes here ..

Bye.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.