Components - Generic, or Enforce Parent Type?

Hi all,

A quick question regarding components if I may…

I have a component for player health, I’ve created it in a very generic fashion, as such it could be added to a player, or an NPC, this feels quite clean and tidy and doesn’t have a reliance on anything to do with the actor its attached to.

In another case I have a component in which I have separated out functionality, primarily at this point to keep the main Actor fairly “clean”, but it has a reliance on another component which is attached to the same actor. Whilst this component gets a reference and checks it is valid, this feels less clean. It led me to wonder the following;

a) should all components be generic enough to be added to any actor
b) is there a way to enforce which actors a component can be added to?

With regards to the health component, I could potentially drop that on to anything, but the other component relates to a more niche behaviour, it would only make sense for it to be added to classes which derive from a specific parent class.

Within Unity there was a way to “require” a component, I suppose what I’m asking is if there is something which is kind of the reverse, e.g. dont let a component be added to an actor unless the actor is of a specific type.

Any thoughts?