Esempio n. 1
0
        /// <summary>
        /// 克隆一个颜色表
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public virtual T Clone <T>(string newName) where T : ColorChart
        {
            if (string.IsNullOrEmpty(newName))
            {
                Debug.LogError("Name can not be null or empty.");
                return(null);
            }

            if (newName == name)
            {
                Debug.LogError("Duplicated Name!");
                return(null);
            }

            T clone = ColorChart.CreateInstance <T>();

            clone.name = newName;
            clone.SetColors(m_Colors);
            return(clone);
        }