static UnityCoroutineRunner() { GameObject go = new GameObject("Svelto.Tasks.UnityScheduler"); _runnerBehaviour = go.AddComponent <RunnerBehaviourUpdate>(); if (Application.isPlaying) { Object.DontDestroyOnLoad(go); } }
static UnityCoroutineRunner() { try { if (Application.isPlaying) { GameObject go = new GameObject("Svelto.Tasks.UnityScheduler"); _runnerBehaviour = go.AddComponent <RunnerBehaviourUpdate>(); Object.DontDestroyOnLoad(go); } } catch { Svelto.Console.LogError ("While Unity runners can be referenced from inside other threads, " + "their very first use must happen inside the Unity main thread"); } }