예제 #1
0
        UnityEngine.Object LoadRes(string name)
        {
            string full_path = root_path + name + ".prefab";

            ZLog.I(null, "{0}", full_path);
            return(LoadResource.LoadAssetAtPath(full_path, typeof(GameObject)));
        }
예제 #2
0
        public UnityEngine.Object  LoadTmpl(string name)
        {
            string[] strList = name.Split(new Char[] { '/', }, StringSplitOptions.RemoveEmptyEntries);
            string   index   = strList[strList.Length - 1];

            UnityEngine.Object obj = LoadResource.Load(name);
            _dictTmpl[index] = obj;
            return(obj);
        }
예제 #3
0
        public static GameObject LoadObject(Transform parent, string path, bool active)
        {
            GameObject ins = LoadResource.LoadAsGameObj(path);

            if (null == ins)
            {
                return(null);
            }
            ins.transform.SetParent(parent, active);
            return(ins);
        }
예제 #4
0
        static public UnityEngine.GameObject LoadAsGameObj(string path)
        {
            GameObject ins = null;
            var        obj = LoadResource.Load(path);

            if (obj != null)
            {
                ins = UnityEngine.Object.Instantiate(obj) as GameObject;
                if (null != ins)
                {
                    ins.name = obj.name;
                }
                else
                {
                    ZLog.E(null, "{0} Instantiate fail", path);
                }
            }

            return(ins);
        }