using UnityEngine; using UnityEngine.UI; using UnityEngine.Events; using System; using System.Linq; using System.Collections; using System.Collections.Generic; using Random = UnityEngine.Random; public static class Extension { #region Regist public static T AddScript(this Component comp) where T : Component { return AddScript(comp.gameObject); } public static T AddScript(this GameObject go) where T : Component { Component comp = go.AddComponent(typeof(T)); if (comp is Regist) { Regist regist = (Regist) comp; regist.enabled = false; regist.InitAtOnce(); Initializer.RegistList.Add(regist); return (T) comp; } else { throw new Exception(); } } #endregion }