Class attributes
The [SelectionBase] attribute will mark any GameObject the component is attached to as the root of selection for the Scene window. This is especially useful if we have meshes that are children of other objects since we may want the parent object to be selected with the first click, instead of the object with the MeshRenderer component.
If we have components with a strong dependency, we can use the [RequireComponent] attribute to force level designers to attach vital components to the same GameObject. This ensures that any dependencies that our code base relies on will be satisfied by designers, without us having to write out a whole bunch of documentation for them.
The [ExecuteInEditMode] attribute will force the object's ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access