Skip to main content

GetComponentsAttribute

A class in Alta.Attributes, the global namespace.

Array field attribute that fills the field with all matching components on the same object when the prefab is applied. Base for the plural GetComponents attributes.

Constructors​

MemberWhat it is
GetComponentsAttribute()Creates a GetComponentsAttribute with default values.

Fields​

1 private and internal field
MemberWhat it is
private static Logger loggerNLog logger for this class.

Properties​

MemberWhat it is
bool IncludeInActive { get; set; }Also includes inactive objects (used by the children and parent variants).
Type Type { get; set; }Component type to look for. Defaults to the array's element type.
bool WarnOnEmpty { get; set; }Meant to log when nothing is found, but the check is never reached.

Methods​

MemberWhat it is
virtual Component[] GetComponents(Transform transform, Type type)Finds the components. Overridden to search children or parents.
override bool HandleApply(Component component, FieldInfo field, GameObject prefab)Replaces the array if the found components differ; returns true if it changed.