/// <summary> /// 获取所有要打包脚本的资源路径 /// </summary> /// <returns></returns> private ArrayList GetBundleScripts() { ArrayList fileList = new ArrayList(); BundleEventTriggerDesigner[] bundleEventTriggers = prefabs.GetComponentsInChildren <BundleEventTriggerDesigner>(); if (bundleEventTriggers != null && bundleEventTriggers.Length > 0) { for (int i = 0; i < bundleEventTriggers.Length; i++) { BundleEventTriggerDesigner betd = bundleEventTriggers[i]; for (int j = 0; j < betd.bundleEventTriggerInfos.Count; j++) { BundleEventTriggerInfo beti = betd.bundleEventTriggerInfos[j]; string path = AssetDatabase.GetAssetPath(beti.method); //转换目录格式 string temp = Application.dataPath; path = temp.Replace("/Assets", "") + "\\" + path; path = path.Replace("/", "\\"); if (!fileList.Contains(path)) { fileList.Add(path); } } } } return(fileList); }
//打包前处理 private void PreBuidleHandler() { BundleEventTriggerDesigner[] bundleEventTriggers = prefabs.GetComponentsInChildren <BundleEventTriggerDesigner>(); if (bundleEventTriggers != null && bundleEventTriggers.Length > 0) { for (int i = 0; i < bundleEventTriggers.Length; i++) { BundleEventTriggerDesigner betd = bundleEventTriggers[i]; //销毁设计师 DestroyImmediate(betd, true); } } }
private void OnEnable() { //ReadCustomStcriptsPath(); bundleEventTriggerDesigner = (BundleEventTriggerDesigner)target; SetupBundleEventTriggerList(); }