Example #1
0
        protected override Pooled_BehaviorUnit createNewUnit <UT>()
        {
            GameObject result_go = null;

            if (m_template != null && m_template is GameObject)
            {
                result_go = GameObject.Instantiate((GameObject)m_template);
            }
            else
            {
                result_go      = new GameObject();
                result_go.name = typeof(UT).Name;
            }
            result_go.name = result_go.name + "_" + m_createdNum;
            UT comp = result_go.GetComponent <UT>();

            if (comp == null)
            {
                comp = result_go.AddComponent <UT>();
            }
            comp.DoInit();
            return(comp);
        }