Hey everyone! I just went through the “Programming quick start” tutorial to get to grips with how code is implemented into the engine, but I appear to have run into an issue which I am not sure how to resolve.
The problem is that the code does not appear to execute, although it compiles with no errors and there are no errors when launching the level. I even went back and copy-pasted the code from the tutorial [here: 4 - Test Your Code | Unreal Engine Documentation], which is as follows for the header:
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "GameFramework/Actor.h"
#include "FloatingActor.generated.h"
UCLASS()
class QUICKSTART_API AFloatingActor : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AFloatingActor();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
float RunningTime;
};
And in the main file:
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "QuickStart.h"
#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;
}
// 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();
float DeltaHeight = (FMath::Sin(RunningTime + DeltaTime) - FMath::Sin(RunningTime));
NewLocation.Z += DeltaHeight * 20.0f; //Scale our height by a factor of 20
RunningTime += DeltaTime;
SetActorLocation(NewLocation);
}
I then created an instance of the class and associated the cone-shape with it, as instructed in the tutorial. The cone itself shows but it does not move. I just need to figure out if this is an issue with the current version of the engine or version changes that may have invalidated pieces of the code. Any ideas?