Download

Editing SceneComponent of a ActorComponent

I created an actor component which has a UBoxComponent in it



class TEST_API UMeleeAttackComponent : public UActorComponent
{
    GENERATED_BODY()

    UMeleeAttackComponent();

    UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Hitbox")
    UBoxComponent* Hitbox;
};


and when I add it to an actor



class TEST_API AMeleeEnemy : public APawn
{
    GENERATED_BODY()

public:
    AMeleeEnemy();

    UPROPERTY(Category = "Attack", VisibleAnywhere, BlueprintReadOnly)
    class UMeleeAttackComponent* MeleeAttack;
};


I can not edit the properties of the Hitbox in blueprint, only the MeleeAttack ones, is it a bug? How can I edit the hitbox properties?

Even If I set MeleeAttack to EditAnywhere and edit the properties of Hitbox there, it does not work.

Nested Actor Components aren’t supported.

While it will compile, you will run into a lot of problems in game. If you need a component to reference another, create them both in the actor, and set the references accordingly. I would suggest using Weak pointers so as not to cause circular dependencies.

Maybe make “UMeleeAttackComponent” a component and not an actor? The name is misleading. :cool:

Aah, that’s too bad!

I wanted to create the hitbox in the melee attack component itself, as every melee attack component requires a hitbox to land the attack. I guess weak pointers will do for now.