how to reference a script without it being attached to a game object code example
Example: how to run code without a gameobject unity
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
// Make sure you remove the "MonoBehaviour"