static public void CreateAssetbundleForChildren() { if (AssetBundleEditorHelper.HasValidSelection()) { bool checkCreate = EditorUtility.DisplayDialog("CreateAssetbundleForChildren Warning", "Create assetbundle for all children of cur selected objects will reset assetbundles which contains this dir, continue ?", "Yes", "No"); if (!checkCreate) { return; } Object[] selObjs = Selection.objects; AssetBundleEditorHelper.CreateAssetbundleForChildren(selObjs); List <string> removeList = AssetBundleEditorHelper.RemoveAssetbundleInParents(selObjs); removeList.AddRange(AssetBundleEditorHelper.RemoveAssetbundleInChildren(selObjs, true, false)); string removeStr = string.Empty; int i = 0; foreach (string str in removeList) { removeStr += string.Format("[{0}]{1}\n", ++i, str); } if (removeList.Count > 0) { Debug.Log(string.Format("CreateAssetbundleForChildren done!\nRemove list :" + "\n-------------------------------------------\n" + "{0}" + "\n-------------------------------------------\n", removeStr)); } } }
static public void ListAssetbundleDependencis(bool isAll) { if (AssetBundleEditorHelper.HasValidSelection()) { string localFilePath = PackageUtils.GetCurBuildSettingAssetBundleManifestPath(); Object[] selObjs = Selection.objects; var depsList = AssetBundleEditorHelper.GetDependancisFormBuildManifest(localFilePath, selObjs, isAll); if (depsList == null) { return; } depsList.Sort(); string depsStr = string.Empty; int i = 0; foreach (string str in depsList) { depsStr += string.Format("[{0}]{1}\n", ++i, str); } string selStr = string.Empty; i = 0; foreach (Object obj in selObjs) { selStr += string.Format("[{0}]{1};", ++i, AssetDatabase.GetAssetPath(obj)); } Debug.Log(string.Format("Selection({0}) directly depends on the following assetbundles:" + "\n-------------------------------------------\n" + "{1}" + "\n-------------------------------------------\n", selStr, depsStr)); } }
static public void ListAssetDependencis() { if (AssetBundleEditorHelper.HasValidSelection()) { Object[] selObjs = Selection.objects; string depsStr = AssetBundleEditorHelper.GetDependencyText(selObjs, false); string selStr = string.Empty; int i = 0; foreach (Object obj in selObjs) { selStr += string.Format("[{0}]{1};", ++i, AssetDatabase.GetAssetPath(obj)); } Debug.Log(string.Format("Selection({0}) depends on the following assets:" + "\n-------------------------------------------\n" + "{1}" + "\n-------------------------------------------\n", selStr, depsStr)); AssetBundleEditorHelper.SelectDependency(selObjs, false); } }