How to add a disabled Component

I want to add a component in its disabled state. When you add a component using addComponent the component is added and runs. I want to add a component and not have it enabled until later.

In TestStart’s Awake function put:

this.enabled = false;

This is old, but the way I dealt with it was to add a new GameObject, then Disable it, then add my components and finally Enable it, this way all of the scripts get executed in the order you would expect and you can set whatever variables you need before Awake.

GameObject _RuntimeComponents = new GameObject();
 _RuntimeComponents.name = "_RuntimeComponents";
 _RuntimeComponents.transform.SetParent(gameObject.transform);
 _RuntimeComponents.SetActive(false);

fsmAnimator = _RuntimeComponents.AddComponent<FsmAnimator>();
fsmAnimator.animator = animator;
 _RuntimeComponents.SetActive(true);

Thanks to @Narmer for only working solution expanding on it this is what i did :
The component below is designed to work with manual initialization and normal mode in editor.
Manual means the component will be added and will be disabled, awaiting the “config” to be provided,
then enabled.
This is achieved by @Narmer s tip in awake.
However because you disable the object in awake it calls OnDisable, so you have to make sure you skip that call by using “initialized” boolean that is set true in OnEnabled.
This allows for component to have manual and auto initialization.

/// <summary>
/// Component has to be enabled from outside, because it starts disabled for delayed initialization
/// </summary>
public class InputBlockerComponent : MonoBehaviour {

    public InputBlockerConfig config;
    /// <summary>
    /// Component will work normally if this is active, otherwise it will be disabled in awake
    /// </summary>
    public bool StartByMyself = false;
    bool initialized;
    void Awake()
    {
        if(!StartByMyself)
            enabled = false;
    }

	void OnEnable()
    {
        InputBlockersSystem.RegisterBlocker(this);
        initialized = true;
    }

    void OnDisable()
    {
        if (!initialized)
            return;
        InputBlockersSystem.UnRegisterBlocker(this);
    }
}

this simple trick works

using UnityEngine;

public abstract class AddComponentAbleMonoBehaviour : MonoBehaviour
{
    protected void Awake() {
        enabled = _startEnable;
        if (enabled)
            Awake2();
    }
    protected abstract void Awake2();

    protected void OnEnable() {
        _isOnceEnabled = true;
        OnEnable2();
    }
    protected abstract void OnEnable2();

    protected void OnDisable() {
        if (_isOnceEnabled == false)
            return;
        OnDisable2();
    }
    protected abstract void OnDisable2();

    protected void Reset() {
        _startEnable = true;
        Reset2();
    }
    protected abstract void Reset2();


    private bool _isOnceEnabled;
    [SerializeField, HideInInspector] bool _startEnable = false;
}

You can set the the enabled flag of the component to false right after you add the component:

TestStart ts = (TestStart)gameObject.AddComponent<TestStart>();
ts.enabled = false;

Awake() will be called, but the Start() call will be put off until the component is enabled. So you can put logic that you want to wait to execute in Start().