Example #1
0
        private static void FindOrCreate()
        {
            var all = FindObjectsOfType <T>();

            _instance = all.Length == 0 ? ComponentUtility.Create <T>() : all[0];
            if (all.Length > 1)
            {
                UCLCore.Logger.LogFormat(LogType.Error, "FindObjectsOfType<{0}>().Length == {1}",
                                         typeof(T).Name, all.Length);
            }
            DontDestroyOnLoad(_instance);
        }