Skip to content

Instantly share code, notes, and snippets.

@OwenMagelssen
Last active July 10, 2022 02:44
Show Gist options
  • Save OwenMagelssen/146a6d6a2874e716d7f8b5ceab2d1a2e to your computer and use it in GitHub Desktop.
Save OwenMagelssen/146a6d6a2874e716d7f8b5ceab2d1a2e to your computer and use it in GitHub Desktop.
System initializer for Unity taken from Tarodev (https://www.youtube.com/watch?v=zJOxWmVveXU)
using UnityEngine;
public static class SystemsLoader
{
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
public static void Execute()
{
var systems = Resources.Load("Systems");
if (!systems)
return;
Object.DontDestroyOnLoad(Object.Instantiate(systems));
Debug.Log("Systems Loaded");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment