Hide
GetComponentInChildren/GetInChildren

Automatically assign a component to a field, if the field value is null and the component is already attached to itself or its child GameObjects. (First one found will be used)

NOTE: Like GetComponentInChildren by Unity, this will check the target object itself.

  • (Optional) EXP config: config. See Saints XPath-like Syntax section for more information.

    Note: You can change the default behavior of these attributes using Window/Saints/Create or Edit SaintsField Config

  • bool includeInactive = false

    Should inactive children be included? true to include inactive children.

  • Type compType = null

    The component type to sign. If null, it'll use the field type.

  • bool excludeSelf = false

    When true, skip checking the target itself.

  • string groupBy = ""

    For error message grouping.

  • Allow Multiple: No

GetInChildren by default does NOT check the target object itself, and does INCLUDE inactive objects.

using SaintsField; [GetComponentInChildren] public BoxCollider childBoxCollider; // by setting compType, you can assign it as a different type [GetComponentInChildren(compType: typeof(Dummy))] public BoxCollider childAnotherType; // and GameObject field works too [GetComponentInChildren(compType: typeof(BoxCollider))] public GameObject childBoxColliderGo;

get_component_in_children