Download

Help Me With! - Derived Class Not Visible/Usable

Can someone explain to me why a derived C++ class is not visible when looking for it in UE Editor?

Example:
I have a component called ComponentParent and there are some variables that are modified within. I can look for and attach it to an Actor, cool! Except, I then create a derived class of the ComponentParent and name it ComponentChild. I try looking for it to attach that component as well (or on another actor) in the editor of the Actor and it can’t be found.

So, I am confused, is derived not the same thing as ‘child’ in BP?

I don’t know the why, but I can show you the how. Go to the ChildComponent.h and add the Blueprintable specifier for the UCLASS macro.

UCLASS(Blueprintable)

That did not work either.
To further add to the confusion, I can cast the parent class to the child class. As well as, find it using the Add Component By Class node, but trying to add it manually to the hierarchy of the actor, it’s non existent.

UCLASS(Blueprintable,BlueprintType)

That didn’t work

Example ComponentParent.h File:

#include “CoreMinimal.h”
#include “Components/ActorComponent.h”
#include “ComponentParent.generated.h”

UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class ComponentParent: public UActorComponent
{
GENERATED_BODY()

public:
ComponentParent();
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
UFUNCTION(BlueprintCallable, meta = (Tooltip = “Add the provided value”), meta = (Keywords = “percent, get”), Category = “User Callable|Value”)
void addValue(float addedValue);

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

Example ComponentChild.h File:

#include “CoreMinimal.h”
#include “ComponentParent.h”
#include “ComponentChild.generated.h”

UCLASS()
class UComponentChild: public UComponentParent
{
GENERATED_BODY()

public:
ComponentChild();
UFUNCTION(BlueprintCallable, meta = (Tooltip = “Add the provided value”), meta = (Keywords = “percent, get”), Category = “User Callable|Value”)
void changeValue(float difValue);
}

To my understanding with the child being a derived class of the parent, should it not be accessible via BP, same as the parent? If I create a new Character and add a component manually to the hierarchy, I can look for and find the Parent but not the Child. If I right-click and look for the Child, a Cast node is all that shows up. If I place Add Component By Class and look for the Child, I can find it? So is it not inheriting from the parent?