🗒️
Ultimate Attributes Pack
  • Introduction
  • Decorators
  • Variable aspect
  • Buttons
  • Folded infos
  • Conditionals
  • Validators
  • Component getters
  • Popups
Powered by GitBook
On this page

Component getters

PreviousValidatorsNextPopups

Last updated 1 year ago

GetComponentInObject

Takes automatically the target component in the object.

Supported property types

  • Object Reference

  • Exposed Reference

  • Managed Reference

Parameters

  • CreateOneIfEmpty

Limitations

Can't be used on arrays and lists.

Code Example

using UltimateAttributesPack;

public class GetComponentInObjectExample : MonoBehaviour
    {
        // GetComponentInObject attribute can be used to automatically get the target component of the object and set the variable with it
        [GetComponentInObject]
        public BoxCollider boxColliderOfObject;

        // You can set the param to true to create a new component in the object automatically if there is none
        // --> [GetComponentInObject(true)]
    }

GetComponentInParent

Takes automatically the target component in the object's parent.

Supported property types

  • Object Reference

  • Exposed Reference

  • Managed Reference

Parameters

  • CreateOneIfEmpty

Limitations

Can't be used on arrays and lists.

Code Example

using UltimateAttributesPack;

public class GetComponentInParentExample : MonoBehaviour
    {
        // GetComponentInParent attribute can be used to automatically get the target component of the object's parent and set the variable with it
        [GetComponentInParent]
        public BoxCollider boxColliderOfParent;

        // You can set the param to true to create a new component in the object's parent automatically if there is none
        // --> [GetComponentInParent(true)]
    }

GetComponentInRoot

Takes automatically the target component in the object's root.

Supported property types

  • Object Reference

  • Exposed Reference

  • Managed Reference

Parameters

  • CreateOneIfEmpty

Limitations

Can't be used on arrays and lists.

Code Example

using UltimateAttributesPack;

public class GetComponentInRootExample : MonoBehaviour
    {
        // GetComponentInRoot attribute can be used to automatically get the target component of the object's root and set the variable with it
        [GetComponentInRoot]
        public BoxCollider boxColliderOfRoot;

        // You can set the param to true to create a new component in the object's root automatically if there is none
        // --> [GetComponentInRoot(true)]
    }