Auto

Oran Bar

(0)
FREE
Publisher Oran Bar
File size 30.56kB
Number of files 26
Latest version 2
Latest release date 2021-04-06 07:27:28
First release date 2021-01-25 10:40:20
Supported Unity versions 2018.4.2 or higher
# 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

Top Publisher Assets