how to run code without a gameobject unity

Code Example - how to run code without a gameobject unity

                
                        [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]

// Make sure you remove the "MonoBehaviour"