Programming Quick Start doesn't work!

I started UE4 today, and tried Programming Quick Start(https://docs.unrealengine.com/en-US/…art/index.html) at first.

I created project by the name of “UE4Example”, copy&pasted all codes indicated on the page, then building project with Visual Studio was completed.

I got “Floating Actor” in Contents Browser.

But when I dragged and dropped it on Perspective ViewPort, nothing appeared.

It appeared in Outliner, but There aren’t “VisualMesh” and Transform Property.

I don’t know what is wrong, please help me!

My code and a screenshot are below.

FloatingActor.h



// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Components/StaticMeshComponent.h"
#include "UObject/ConstructorHelpers.h"
#include "UObject/Object.h"
#include "FloatingActor.generated.h"

UCLASS()
class UE4EXAMPLE_API AFloatingActor : public AActor
{
GENERATED_BODY()

public:
// Sets default values for this actor's properties
AFloatingActor();

UPROPERTY(VisibleAnywhere)
UStaticMeshComponent* VisualMesh;

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

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

};


FloatingActor.cpp



// Fill out your copyright notice in the Description page of Project Settings.


#include "FloatingActor.h"

// Sets default values
AFloatingActor::AFloatingActor()
{
// 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;

VisualMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));

VisualMesh->SetupAttachment(RootComponent);

static ConstructorHelpers::FObjectFinder<UStaticMesh> CubeVisualAsset(TEXT("/Game/StarterContent/Shapes/Shape_Cube.Shape_Cube"));

if (CubeVisualAsset.Succeeded())
{
VisualMesh->SetStaticMesh(CubeVisualAsset.Object);
VisualMesh->SetRelativeLocation(FVector(0.0f, 0.0f, 0.0f));
}



}

// Called when the game starts or when spawned
void AFloatingActor::BeginPlay()
{
Super::BeginPlay();

}

// Called every frame
void AFloatingActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);

FVector NewLocation = GetActorLocation();

FRotator NewRotation = GetActorRotation();

float RunningTime = GetGameTimeSinceCreation();

float DeltaHeight = (FMath::Sin(RunningTime + DeltaTime) - FMath::Sin(RunningTime));

NewLocation.Z += DeltaHeight * 20.0f;

float DeltaRotation = DeltaTime * 20.0f;

NewRotation.Yaw += DeltaRotation;

SetActorLocationAndRotation(NewLocation, NewRotation);

}


ScreenShot(Imgur: The magic of the Internet)

Sorry, I couldn’t paste my screenshot on this post. Uploading image was failed with message “Image resize failed due to your image library not having support for this image type.”.

UPDATE---------------------------------------------------

After I rebooted an editor, project started to work fine.

But I must have selected a mesh of “VisualMesh” property by myself, though it is selected automatically in Quick Start.

I guess creating CubeVisualAsset is failed, but why?

Likely it couldn’t find the asset in this path:
“/Game/StarterContent/Shapes/Shape_Cube.Shape_Cube” Make sure the cube is there. You should be able to hover over the field you manually set and see the path you set, then compare the two. In the end, it doesn’t terribly matter - but that’s why it wouldn’t “auto select”. It simply couldn’t find it.

Can you explain how you “selected a mesh of “VisualMesh” property” ?

Thank you for replying!

After I replaced “Shape_Cube.Shape_Cube” with “Shape_Cube”, “auto select” started to work fine.

Thank you very much!

Official tutorial page has many many mistakes!

In addition a mistake about this post, I must have added some includes which aren’t indicated in the page.

Am I referring something old? If you knew new or more reliable tutorial pages, please tell me!

1 Like

>> Senoyoru

Click “FloatingActor” in “World Outliner”, and set a mesh in “StaticMesh” property.

I thought this “StaticMesh” property appeared because “FloatingActor” class has “VirtualMesh” and its type is UStaticMeshComponent.

So I expressed “selected a mesh of “VirtualMesh” property”.

I’m very new to UE4. If I’m misunderstanding, please point out!

Thank you for replying!