Hi, i want to use my texture as highmap for a landscape, but as soon i’m creating an ULandscapeComponent with CreateDefeaultSubobject function i’m getting this error:
Fatal error: [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/CoreUObject/Private/UObject/UObjectGlobals.cpp] [Line: 2276] Object LandscapeComponent LSComp created in Test instead of LandscapeProxy
What am i doing wrong? I just want to learn, how to use SetHeighmap function so that i can work with a landscape generator later on. What should i do to create ULandscapeComponent properly?
There are my codes:
Test.h
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "LandscapeComponent.h"
#include "Test.generated.h"
UCLASS()
class PROJEKT3D_API Test: public AActor
{
GENERATED_BODY()
public:
Test();
protected:
virtual void BeginPlay() override;
public:
virtual void Tick(float DeltaTime) override;
ULandscapeComponent *LSComp;
};
Test.cpp
#include "Test.h"
// Sets default values
Test::Test()
{
PrimaryActorTick.bCanEverTick = true;
LSComp = CreateDefaultSubobject<ULandscapeComponent>(TEXT("LSComp"));
}
void Test::BeginPlay()
{
Super::BeginPlay();
}
void Test::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
Nothing really fancy yet becouse of this error.
Also i’ve added this:
PublicDependencyModuleNames.AddRange(new string[] { "Landscape" });
to my Project.build.cs file so that i’m not getting LNK2019 error anymore.