Back to Writing
NOTESunitygame-devcsharpcomponentsattributes
Unity - RequireComponent Attribute
March 15, 2020•Updated Feb 17, 2026
An attribute I stumbled upon recently,
as the name suggests — "require component" —
when you attach this script to a GameObject,

it automatically adds the class specified as a parameter in the typeof function as a component on the same GameObject.