Is it possible to add Custom Derived Actor Components to Actors? I am able to create a new C++ class with the parent class being an Actor Component and add this component to an actor. But if I then create a new C++ class with the parent class being the new C++ class I previously created. I don’t seem to be able to add this derived class to my actor.
For example, if I create a blueprint actor called “BP_NewBlueprint” and add a new component to this actor by selecting Add>New C++ Component>Actor Component, and name it NewActorComponent, I get a new Actor Component I can add to BP_NewBlueprint as a component (displayed as New Actor)
But if I then create another component by selecting Add>New C++ Component>All Classes, search for NewActorComponent, select it and name it NewActorComponentChild, I CANNOT add it to BP_NewBlueprint as it does not show up when I search for it.
Can you share the code in the NewActorComponentChild.h file generated when you created NewActorComponentChild component?
I suspect you might have to add “Blueprintable” to the UCLASS macro in it.
Hello Extrone! Thanks for the comment! NewActorComponentChild.h contained the following:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "NewActorComponent.h"
#include "NewActorComponentChild.generated.h"
/**
*
*/
UCLASS()
class MYPROJECT_API UNewActorComponentChild : public UNewActorComponent
{
GENERATED_BODY()
};
Based on what Extrone said, I copied the UCLASS macro from NewActorComponent.h into NewActorComponentChild.h making it the following:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "NewActorComponent.h"
#include "NewActorComponentChild.generated.h"
/**
*
*/
UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class MYPROJECT_API UNewActorComponentChild : public UNewActorComponent
{
GENERATED_BODY()
};