Как запустить код без единства GameObject
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
// Make sure you remove the "MonoBehaviour"
Bonus
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
// Make sure you remove the "MonoBehaviour"