OnEnable() Function in Unity

Notes:

OnEnable() Function in Unity:

2. immediately script is enabled

OnEnable method:
- after Awake method is executed immediately OnEnable method is called
- is also called whenever the script gets enabled

- is best for resetting object properties / variables or executing some code; whenever a script gets enabled

Example Code:

void OnEnable()
{
Debug.Log ("OnEnable");
}