Okay, that worked. Now, I want to use it with C++, but I just can’t seem to get it working. Please have in mind that I’m starting with C++. So:
Added lines in Build.cs:
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class FlyingShip : ModuleRules
{
public FlyingShip(TargetInfo Target)
{
PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore"});
PrivateDependencyModuleNames.AddRange(new string] { });
PublicDependencyModuleNames.AddRange(new string] { "ShaderCore", "RenderCore", "RHI", "RuntimeMeshComponent"});
}
}
*.h file:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/Actor.h"
#include "SeaSurface.generated.h"
UCLASS()
class FLYINGSHIP_API ASeaSurface : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ASeaSurface();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
private:
UPROPERTY(VisibleAnywhere, Category = Materials)
RuntimeMeshComponent * SeaMesh;
};
*.cpp file:
// Fill out your copyright notice in the Description page of Project Settings.
#include "FlyingShip.h"
#include "SeaSurface.h"
#include "RuntimeMeshComponent.h"
// Sets default values
ASeaSurface::ASeaSurface()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
SeaMesh = CreateDefaultSubobject<RuntimeMeshComponent>(TEXT("GeneratedMesh"));
RootComponent = SeaMesh;
}
// Called when the game starts or when spawned
void ASeaSurface::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ASeaSurface::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
}
Error:
1>------ Build started: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------
2>------ Build started: Project: FlyingShip, Configuration: Development_Editor x64 ------
2> Creating makefile for FlyingShipEditor (no existing makefile)
2> Parsing headers for FlyingShipEditor
2> Running UnrealHeaderTool "O:\FlyingShip\FlyingShip.uproject" "O:\FlyingShip\Intermediate\Build\Win64\FlyingShipEditor\Development\FlyingShipEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
2>O:/FlyingShip/Source/FlyingShip/FishingShip/SeaSurface.h(25): error : Unrecognized type 'RuntimeMeshComponent' - type must be a UCLASS, USTRUCT or UENUM
2>EXEC : error : UnrealHeaderTool failed for target 'FlyingShipEditor' (platform: Win64, module info: O:\FlyingShip\Intermediate\Build\Win64\FlyingShipEditor\Development\FlyingShipEditor.uhtmanifest, exit code: OtherCompilationError (5)).
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(37,5): error MSB3075: The command ""E:\Unreal Engine 4\Epic Games\4.14\Engine\Build\BatchFiles\Build.bat" FlyingShipEditor Win64 Development "O:\FlyingShip\FlyingShip.uproject" -waitmutex" exited with code 5. Please verify that you have sufficient rights to run this command.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What am I doing wrong?