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))); }
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); }
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); }
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); }