Example #1
0
        public static BatchSystem Get <T>()
        {
            if (container == null)
            {
                container = GameObject.Find("SystemContainer");
            }
            if (container == null)
            {
                container = new GameObject("SystemContainer");
            }

            if (system == null)
            {
                system = container.GetComponent <BatchSystem>();
            }
            if (system == null)
            {
                system = container.AddComponent <BatchSystem>();
            }
            if (!system.types.Contains(typeof(T)))
            {
                var action = SurrogateRegister.Instance.GetSurrogateAction(typeof(T).GetMethod("UpdateBatch"));
                if (action != null)
                {
                    system.types.Add(typeof(T));
                    system.methods.Add(action);
                    isDirty = true;
                }
            }
            return(system);
        }
Example #2
0
 protected virtual void OnEnable()
 {
     if (Instances == null)
     {
         Instances = new List <T>();
     }
     system = BatchSystem.Get <T>();
     Instances.Add(this as T);
 }