Пример #1
0
        private GameObject AddObject(string key)
        {
            GameObject prefab = ResourcesManager.Load <GameObject>(key);

            if (prefab == null)
            {
                Debug.LogError("cant load resource " + key);
            }
            GameObject go = GameObject.Instantiate(prefab);

            go.name = prefab.name;
            //if (!m_cacheList.ContainsKey(key))
            //{
            //    m_cacheList.Add(key, new List<GameObject>());
            //}
            //m_cacheList[key].Add(go);

            return(go);
        }
Пример #2
0
        private GameObject AddObject(string key)
        {
            GameObject prefab = ResourcesManager.Load <GameObject>(key);

            if (prefab == null)
            {
                Debug.LogError("cant load resource " + key);
            }
            GameObject go = GameObject.Instantiate(prefab);

            go.name = go.name.Replace("(Clone)", "");

            if (!go.GetComponent <PrefabData>())
            {
                go.AddComponent <PrefabData>().pathName = key;
            }
            //if (!m_cacheList.ContainsKey(key))
            //{
            //    m_cacheList.Add(key, new List<GameObject>());
            //}
            //m_cacheList[key].Add(go);

            return(go);
        }