Using the right terminology is vital to understand what the documentation is talking about.
GameObjects (which are just containers) have an active state. This can be controlled with the SetActive method of the gameobject. The active state is organised in a hierachical structure. So the state of the parent is “inherited” by all child objects. A GameObject is only active when itself is set active (can be checked with the activeSelf property) and all of the parents are active as well. If one parent has been deactivated, all children and grand children will be deactivated as well. To check if a certain gameobject is actually active or not one can use the activeInHierarchy property which is only true when the gameobject itself and all it’s parents are active.
Deactivated GameObject behave like they don’t exist at all. They are essentially excluded from almost any processing inside the engine.
Apart from the active state of the gameobject, components which are attached to gameobjects can have an “enabled” state as well. This enabled state only controls the behaviour of this one component. The enabled state of components are also bound to the active state of the gameobject since, as i said above, gameobjects are essentially dead if it’s not active. In other words components which have an enabled state (like MonoBehaviour derived classes and some build-in components) only work when they are enabled and the gameobject it’s attached to is activeInHierarchy.
The various callbacks that a script component (MonoBehaviour derived class) can receive depend on the state change of the enabled property and active state of the gameobject.
OnEnable and OnDisable are called whenever the script is enabled or disabled. This can happen due to various actions. First of all scripts which are attached to a gameobject in a scene get OnEnabled called when the scene loads only if the gameobject is active and the script is enabled. Whenever you disable any parent gameobject the script component will get OnDisable called. This also happens when you set the enabled property to false.
In short: OnEnabled is called the moment the script is actually “running” (when it’s “enabled”) and OnDisable is called as soon as the script is disabled. As far as i remember the OnEnabled / OnDisable callback is actually invoked from inside the enabled property / SetActive call.
Unlike OnEnable / OnDisable which are called everytime the script is enabled / disabled, there is also the Awake and the OnDestroy callback. Those are independent from the enabled state of the script. Those are only bound to the active state of the gameobject. Also both, Awake and OnDestroy are only called once or not at all in the lifetime of a component. Awake is called as soon as the gameobject the script is attached to is active for the first time. So usually an active gameobject in a scene get Awake called right after it has been loaded. If the script is enabled Awake and OnEnabled will be called right after the other. OnDestroy will be called when the script component is destroyed. Of course whenever the parent gameobject is destroyed all components attached to that gameobject will be destroyed as well. I’ll add the same note as the documentation: OnDestroy is only called when the object was active at least once. So only if Awake has been called previously. So a deactivated object that stays deactivated all the time does not get the OnDestroy callback when it’s destroyed since it never was actually an active part of the scene.
So the important thing to remember is the actual logical hierarchy of the active state of the gameobject(s) and the enabled state of attached components. Once you understand this relationship the purpose of the callbacks should become clear.
Just to directly answering your sub question: A script that is disabled (enabled set to false) but is attached to a gameobject that is active does not get OnEnable called since the script is not enabled yet. Just in theory you could now deactivate the gameobject (SetActive(false)) and set enabled to true. This will not call OnEnable since the gameobject is not active.
ps: about the paragraphs here on UA: About 2 years ago there was a (strange) update on UnityAnswers which broke the Markdown renderer. paragraphs, bulletpoint lists and some other features are no longer interpreted correctly. Unfortunately there’s nothing we can do about that. Currently to insert a paragraph you have to use an empty line followed by
followed by another empty line.