Hello,
I am facing an issue where I cannot see the details panel of my component. It would be greatly appreciated if anyone can help. I have outlined the steps I took to reproduce my issue and what I have tried so far below.
Issue
I have an AMyCharacter
class that derives from ACharacter
. I want to add a custom Ability Component to it - this class will be responsible for firing abilities from AMyCharacter
.
This custom component is called UAbilityComponent
and it derives from UActorComponent
.
1. Adding AMyCharacter
2. Rider generated MyCharacter.h
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "MyCharacter.generated.h"
UCLASS(Blueprintable)
class MYGAME_API AMyCharacter : public ACharacter
{
GENERATED_BODY()
public:
// Sets default values for this character's properties
AMyCharacter();
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;
};
3. Rider generated MyCharacter.cpp
#include "Test/MyCharacter.h"
// Sets default values
AMyCharacter::AMyCharacter()
{
PrimaryActorTick.bCanEverTick = true;
}
// Called when the game starts or when spawned
void AMyCharacter::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AMyCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// Called to bind functionality to input
void AMyCharacter::SetupPlayerInputComponent(
UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
}
I then create a child blueprint from AMyCharacter
.
There is no issue so far.
Then, I introduced my UAbilitiesComponent
.
1. AbilitiesComponent.h
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "AbilitiesComponent.generated.h"
UCLASS(meta=(BlueprintSpawnableComponent))
class MYGAME_API UAbilitiesComponent : public UActorComponent
{
GENERATED_BODY()
public:
UAbilitiesComponent();
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType,
FActorComponentTickFunction*
ThisTickFunction) override;
protected:
// Called when the game starts
virtual void BeginPlay() override;
// Property for testing purposes
UPROPERTY(EditAnywhere, BlueprintReadOnly)
float TestFloat = 0;
};
2. UAbilitiesComponent.cpp
#include "AbilitiesComponent.h"
UAbilitiesComponent::UAbilitiesComponent()
{
}
// Called when the game starts
void UAbilitiesComponent::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void UAbilitiesComponent::TickComponent(float DeltaTime, ELevelTick TickType,
FActorComponentTickFunction*
ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
}
Finally, I introduce the UAbilitiesComponent
into AMyCharacter
via UPROPERTY
.
1. Updated MyCharacter.h
#pragma once
#include "CoreMinimal.h"
#include "AbilitiesComponent.h"
#include "GameFramework/Character.h"
#include "MyCharacter.generated.h"
UCLASS(Blueprintable)
class MYGAME_API AMyCharacter : public ACharacter
{
GENERATED_BODY()
public:
// Sets default values for this character's properties
AMyCharacter();
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;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TObjectPtr<UAbilitiesComponent> AbilitiesComponent;
};
2. Updated MyCharacter.cpp
#include "Test/MyCharacter.h"
// Sets default values
AMyCharacter::AMyCharacter()
{
PrimaryActorTick.bCanEverTick = true;
AbilitiesComponent = CreateDefaultSubobject<UAbilitiesComponent>(
TEXT("Ability Component"));
}
// Called when the game starts or when spawned
void AMyCharacter::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AMyCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// Called to bind functionality to input
void AMyCharacter::SetupPlayerInputComponent(
UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
}
Now, I close the editor, compile, and open BP_MyCharacter
.
The details panel for the new component shows up as expected.
Next, I close the editor, then open it again.
The details panel is now gone.
Attempted Solutions
I have tried several solutions after searching on the forums, but none of them have helped. They are listed below:
-
In the class default constructor, change the name given to the component during
CreateDefaultSubobject<>()
→ Didn’t work. Details panel is still empty. -
In
AMyCharacter
, change the variable name for theUAbilitiesComponent
.
→ Didn’t work. Details panel is still empty. -
Reparenting, then parenting back.
→ Works only once. After closing and opening the editor, the details panel is gone again.
Before
After
- Recreating the entire blueprint. Works only once. After closing and opening the editor, the details panel is gone again.
Before
After
- Deleting Intermediate and Saved folders and recompiling. Doesn’t work.
Any help would be greatly appreciated. If more information is needed please let me know so I can provide it.