Issues with Adding properties native in C++

The issue I’m having deals with one of my UPropertys not letting me see anything in the Details window in the editor.

FireAbility.h



#pragma once

#include "GameFramework/Actor.h"
#include "FireAbility.generated.h"

/**
 * 
 */
UCLASS()
class AFireAbility : public AActor
{
	GENERATED_UCLASS_BODY()

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Movement)
	TSubobjectPtr<class USphereComponent> CollisionComp;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Movement)
	TSubobjectPtr<class UProjectileMovementComponent> ProjectileMovement;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Particle)
	TSubobjectPtr<UParticleSystemComponent> FireScale;


	
};


FireAbility.cpp



#include "SideScrollerConcept.h"
#include "FireAbility.h"
#include "ParticleDefinitions.h"

AFireAbility::AFireAbility(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{
	CollisionComp = PCIP.CreateDefaultSubobject<USphereComponent>(this, TEXT("SphereComp"));
	CollisionComp->InitSphereRadius(15.0f);
	RootComponent = CollisionComp;

	ProjectileMovement = PCIP.CreateDefaultSubobject<UProjectileMovementComponent>(this, TEXT("ProjectileComp"));
	ProjectileMovement->InitialSpeed = 3000.0f;
	ProjectileMovement->UpdatedComponent = CollisionComp;
	ProjectileMovement->MaxSpeed = 3000.0f;
	ProjectileMovement->bRotationFollowsVelocity = true;
	ProjectileMovement->bShouldBounce = true;
	ProjectileMovement->Bounciness = 0.3f;

	FireScale = PCIP.CreateDefaultSubobject<UParticleSystemComponent>(this, TEXT("Fire_Scale"));
	FireScale->AttachTo(RootComponent);
}


and it looks like this in the Component Editor when I select the Native ParticleComponent for the FireScale
146b7f18e016f86eb79cc0e799015f3b50f8f279.jpeg

The Detail window is empty :confused:

but I have exact same code for my Nature projectile class and it lets me change things in the Details window

NatureAbility.h



#pragma once

#include "GameFramework/Actor.h"
#include "NatureAbility.generated.h"

/**
 * 
 */
UCLASS()
class ANatureAbility : public AActor
{
	GENERATED_UCLASS_BODY()

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Movement)
	TSubobjectPtr<class USphereComponent> CollisionComp;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Movement)
	TSubobjectPtr<class UProjectileMovementComponent> ProjectileMovement;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Particle)
	TSubobjectPtr<UParticleSystemComponent> NatureScale;
	
};


NatureAbility.cpp




#include "SideScrollerConcept.h"
#include "NatureAbility.h"
#include "ParticleDefinitions.h"


ANatureAbility::ANatureAbility(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{

	CollisionComp = PCIP.CreateDefaultSubobject<USphereComponent>(this, TEXT("SphereComp"));
	CollisionComp->InitSphereRadius(15.0f);
	RootComponent = CollisionComp;

	ProjectileMovement = PCIP.CreateDefaultSubobject<UProjectileMovementComponent>(this, TEXT("ProjectileComp"));
	ProjectileMovement->InitialSpeed = 3000.0f;
	ProjectileMovement->UpdatedComponent = CollisionComp;
	ProjectileMovement->MaxSpeed = 3000.0f;
	ProjectileMovement->bRotationFollowsVelocity = true;
	ProjectileMovement->bShouldBounce = true;
	ProjectileMovement->Bounciness = 0.3f;

	NatureScale = PCIP.CreateDefaultSubobject<UParticleSystemComponent>(this, TEXT("NatureScale"));
	NatureScale->AttachTo(RootComponent);
}


and here’s the Nature Component Editor with the Native ParticleComponent selected
ca09588dc2f43d8a470cee4a93e2aa4dc1d741c6.jpeg

The Detail Window has properties i can change.

Any idea what’s happening here?


FireScale = PCIP.CreateDefaultSubobject<UParticleSystemComponent>(this, TEXT("Fire_Scale"));

Should be


FireScale = PCIP.CreateDefaultSubobject<UParticleSystemComponent>(this, TEXT("FireScale"));

Also, you’d like to create AAbility class with those components. Then create blueprints based on this class and change components accordingly as you want. And if needed, create AFireAbility as child of AAbility, if AFireAbility is presumed to have some additional data.
Regards.

I have tried to make inheritance for the abilities with an Ability class, however, it would not compile when I made a new code that inherited from Ability :/.
Also the code change did not work :(.

That is quite strange. Did you create the BP before or after you added the ParticleSystemComponent to the base class? Does creating a new Blueprint after added the property make any difference?

BTW the name you pass into CreateDefaultSubobject does not need to match the property name. That is just a name you can use to identify the component if you want to change something about it in a derived C++ class.

What error message did you get? Did you include the header file of your parent class?

@James:
I thought the same too!!! However, I made another new blueprint inheriting the FireAbility class… and behold the Details appear in the particle details!!! :D!! but it wont let me delete the old blueprint :(.

@order66: Yes i did include the header file to my parent class. Frustrated me that I couldn’t make class inheritance to these objects :frowning:

Simple recompiling blueprint would’ve fixed that i assume. But i’m glad everything works now.
Would like to assist with inheritance if you provide at least some info about error.