Hello, I want to see if somebody can help me with this lecture, it is the one from the Toon Tanks section in the C++ UE4 developer course and I am trying to put the projectile spawn point in the pawn, but nothing appears.
This is the code I have in the header file
BasePawn.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "BasePawn.generated.h"
UCLASS()
class TOONTANKS_API ABasePawn : public APawn
{
GENERATED_BODY()
public:
// Sets default values for this pawn's properties
ABasePawn();
UPROPERTY(VisibleInstanceOnly)
int32 VisibleInstanceOnlyInt = 5;
UPROPERTY(VisibleDefaultsOnly)
int32 VisibleDefaultsOnly = 8;
UPROPERTY(EditDefaultsOnly)
int32 EditDefaultsOnlyInt = 14;
UPROPERTY(EditInstanceOnly)
int32 EditInstanceOnlyInt = 20;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
private:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = "true"))
class UCapsuleComponent* CapsuleComp;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = "true"))
UStaticMeshComponent* BaseMesh;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = "true"))
UStaticMeshComponent* TurretMesh;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = "true"))
USceneComponent* ProjectileSpawnPoint;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "SuperDuperVariables", meta = (AllowPrivateAccess = "true"))
float Health = 100.f;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "SuperDuperVariables", meta = (AllowPrivateAccess = "true"))
int32 VisibleAnywhereInt = 10;
};
And this is the one I have so far in the CPP file
BasePawn.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "Components/CapsuleComponent.h"
#include "Components/StaticMeshComponent.h"
#include "BasePawn.h"
// Sets default values
ABasePawn::ABasePawn()
{
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
CapsuleComp = CreateDefaultSubobject<UCapsuleComponent>(TEXT("Capsule Collider"));
RootComponent = CapsuleComp;
BaseMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Base Mesh"));
BaseMesh->SetupAttachment(CapsuleComp);
TurretMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Turret Base"));
TurretMesh->SetupAttachment(BaseMesh);
ProjectileSpawnPoint = CreateDefaultSubobject<USceneComponent>(TEXT("Spawn Point"));
ProjectileSpawnPoint->SetupAttachment(TurretMesh);
}
// Called when the game starts or when spawned
void ABasePawn::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ABasePawn::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// Called to bind functionality to input
void ABasePawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
}
And this is the image to show that it doesn’t show up.
I hope someone can help me with this problem I have.