I have created a C++ class based on Actor named MyBaseClass. It has a SceneComponent and StaticMeshComponent in it. I then derived a Blueprint class from MyBaseClass and named it MyBaseClass_BP. Then I created a Blueprint class named My_Pure_BP_Class based on Actor and added SceneComponent and StaticMeshComponent to it. Here are my Questions
- The SceneComponent and StaticMeshComponent are showing up differently in MyBaseClass_BP and My_Pure_BP_Class. I don’t understand why is this so?
- StaticMeshComponent of My_Pure_BP_Class is having events section where I can directly create events by clicking on the big green button, but MyBaseClass_BP doesn’t have that.
What am I missing?
Here is the code:
//MyBaseClass.h
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "MyBaseClass.generated.h"
UCLASS()
class MYPROJECT_API AMyBaseClass : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AMyBaseClass();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Custom")
class USceneComponent* MyRootComponent;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Custom")
class UStaticMeshComponent* MyStaticMeshComponent;
};
//MyBaseClass.cpp
#include "MyBaseClass.h"
#include "Components/StaticMeshComponent.h"
#include "Components/SceneComponent.h"
// Sets default values
AMyBaseClass::AMyBaseClass()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = false;
MyRootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("My Root"));
RootComponent = MyRootComponent;
MyStaticMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("My Static Mesh"));
MyStaticMeshComponent->AttachTo(MyRootComponent);
}
// Called when the game starts or when spawned
void AMyBaseClass::BeginPlay()
{
Super::BeginPlay();
}
Images of MyBaseClass_BP and My_Pure_BP_Class are also attached.
MyBaseClass_BP
My_Pure_Base_Class_BP
My_Pure_Base_Class_BP Here is the Events Section which I was talking about. This is missing in MyBaseClass_BP
Another Screenshot of MyBaseClass_BP