Referencing monobehaviour singleton from a non-monobehaviour class?

Hey I’m getting a NullReferenceException from this line of code:

List<Trait> possibleTraits = new List<Trait>(TraitDatabase.Instance.traits);

That line is called in a class Character, which does not derive from monobehaviour, whilst TraitDatabase is a script that does inherit from monobehaviour.

This is the script for TraitDatabase:

public class TraitDatabase : MonoBehaviour
{
    public static TraitDatabase Instance { get; private set; }
    public Trait[] traits;

    public void Awake()
    {
        SetSingleton();
    }

    void SetSingleton()
    {
        if (Instance == null)
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }
    }
}

I have set the size for the Trait array in the inspector for the TraitDatabase script and filled it with ScriptableObjects Trait. So I’m fairly certain that that isn’t what is causing this error. Is it possible that this error is related to monobehaviour?

Turns out that the problem was that the line throwing the error was called in the Awake of some class, whilst as you can see, in the TraitDatabase, the singleton is also being set in Awake. Moving the call of this character class line to a start method solved it.