Skip to content
RED SAGSkills
easyGame Developer interview question

Why do game engines like Unity and Unreal favour components over deep inheritance trees for game objects?

What the interviewer wants to hear

  • Deep hierarchies become rigid when an object needs behaviour from two branches
  • Components are small reusable pieces of behaviour attached to an object
  • Designers can mix components to create new object types without code
  • Components are easier to test and reuse across projects
  • Inheritance is still useful for shallow base classes

Model answer

With inheritance you quickly get trees like Enemy, FlyingEnemy, ShootingEnemy, and then you need a flying shooting enemy and the tree breaks. Components solve this through composition: an object is a container, and behaviour comes from small pieces like Health, Mover, Shooter or Flyer. You build a new enemy by attaching the right components, and designers can do it in the editor without new code. Each component has one job, so it is easier to reuse, test and debug. Unity GameObjects with MonoBehaviours and Unreal Actors with ActorComponents both work this way. I still use inheritance, but keep it shallow, for example a base Weapon class with a few subclasses, and put shared behaviour in components or interfaces.

Can you answer it under time pressure?

Take a timed easy round and get scored on every answer.

Start mock interview

More easy Game Developer questions