[C++] Inheritance: Ability: UComponent vs AActor


I’ve been working on an fps game with abilities. Originally I thought it best to have The Abilities inherit from UComponent but had issues(I’m new) to making the input carry through to functions coded in the component. So, I switched to AActor.

Now, I have to set a RootComponent for the abilities, and I’m starting to think that making abilities an AActor was a mistake because I don’t see a reason why the Abilities should need a USceneComponent. Abilities will sometimes spawn Projectiles.

What are your thoughts on this, should the Abilities class inherit from UComponent, or AActor? Why?

Thank again for the help!

I’d go with an ability manager as a component, attached to your character.

And the abilities would be regular UObject.

Can you tell me more? I’m an unreal noob (it’s been a steep learning curve)

What kind of abilities do you have in mind?

Because if it’s abilities like sprint / dash / dodge / swim, it’s neither in a component or an actor, but directly in your character class

Grapple Hook, Frenzy(stat boost), Phase Shift(disappear into the ether), Scan Pulse (Reveal nearby enemies)

Grapple Hook should be an individual actor (like a weapon) which would alter the player position when used
Frenzy and Phase Shift should be coded inside your character class
Scan Pulse could be an actor you spawn in the world