Over 11,000 five-star assets

Rated by 85,000+ customers

Supported by 100,000+ forum members

Every asset moderated by Unity

1/3
# Auto Attributes

This package provides 3 attributes:
[Auto], [AutoParent], [AutoChildren]

Autos are field/property attributes that allow to automatically get/fetch components' references when the application is started.
This solution is presented as equivalent of having an Awake function containing GetComponent calls.

It runs before all other Awakes (using script execution ordering), so whenever Awake starts execution, one can assume that no variable with Auto will throw a null exception.
If a component is not found, Auto will provide descriptive logging.

[AutoParent] and [AutoChildren] can also be used on Array variables, and respectively have the same behaviour you would expect from a T[] GetComponentsInParents() or T[] GetComponentsInChildren() call.
Auto also works on inactive objects.

Auto works by hooking into the awake function of a Manager monobehaviour script, which is automatically spawned in the scene whenever it is saved.

# Instantiation

In case of instantiated objects, please use the MonoBehaviour extension method this.Instantiate_And_AutoAssignVariables() to make sure Auto does the referencing before anyone else starts using that class


# Requisites

All scripts using Auto must have their script execution order delay < 990.

# Installation

As soon as the package is installed, you can already start making use of the Auto Attributes!
# Support

For support, refer to my github page

Auto

(not enough ratings)
11 users have favourite this asset
(11)
FREE
License type
File size
30.6 KB
Latest version
2.51
Latest release date
Apr 6, 2021
Original Unity version
2019.4.6
Support
Visit site
Quality assets
Over 11,000 five-star assets
Trusted
Rated by 85,000+ customers
Community support
Supported by 100,000+ forum members
Unity logo
Language
Feedback
Partners Program
Partners
USD
EUR
Copyright © 2025 Unity Technologies
All prices are exclusive of tax
USD
EUR