Hey, new to coding and I’m stuck on something in this tutorial. https://www…com/watch?v=Q3AvZmZEPyc
I’ve been trying for hours and just can’t get my new class to show up in UE4, I need some help.
I’m following the tutorial to the letter, so far as I can tell, no typos in the code. It compiles without errors, but I can’t find the new class in the UE4 menus.
Check video at 15:50
The new base class “Powerup” shows up for him, but not for me.
Another thing, is when he selects an object and in the Details panel, clicks the link to the .h file, Visual Studio does not load up for me like in the video. Does that feature not work with VS 2013 Express?
Note: I also tried the tutorial here for creating a new class to print “Hello World”, and it worked easily. I’m not sure why the other “Powerup” class doesn’t show up.
https://docs.unrealengine.com/latest/INT/Programming/QuickStart/3/index.html
//Powerup.h
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "GameFramework/Actor.h"
#include "Powerup.generated.h"
/**
*
*/
UCLASS()
class APowerup : public AActor
{
GENERATED_UCLASS_BODY()
UPROPERTY(EditDefaultsOnly, VisibleDefaultsOnly, Category = Powerup)
TSubobjectPtr<USphereComponent> TouchSphere;
UPROPERTY(EditDefaultsOnly, VisibleDefaultsOnly, Category = Powerup)
float RotationRate;
virtual void Tick(float DeltaTime) OVERRIDE;
};
//Powerup.cpp
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#include "Pizza.h"
#include "Powerup.h"
APowerup::APowerup(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
PrimaryActorTick.bCanEverTick = true;
TouchSphere = PCIP.CreateDefaultSubobject<USphereComponent>(this, TEXT("TouchSphereComponent"));
TouchSphere->SetSphereRadius(20.f, false);
RootComponent = TouchSphere;
RotationRate = 180.f;
}
void APowerup::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
FRotator MyRot = GetActorRotation();
MyRot.Roll += RotationRate * DeltaTime;
SetActorRotation(MyRot);
}