public static bool PackHasErrors(AssetObjectPack pack, EditorProp packProp) { //duplicate param names if (packProp[defaultParametersField].ContainsDuplicateNames(out _)) { return(true); } if (!pack.isCustom) { //check variables Func <string, bool>[] validChecks = new Func <string, bool>[] { IsValidTypeString, IsValidDirectory, FileExtensionValid }; string[] fieldChecks = new string[] { pack.assetType, pack.dir, pack.extensions }; for (int x = 0; x < 3; x++) { if (!validChecks[x](fieldChecks[x])) { return(true); } } } return(false); }
void UpdateIDsForPack(AssetObjectPack pack) { string[] pathsWithoutIDs = EditorUtils.GetFilePathsInDirectory(pack.dir, true, pack.extensions, AssetObjectsEditor.sIDKey, false); if (pathsWithoutIDs.Length == 0) { Debug.Log("All assets in " + pack.name + " objects directory have IDs"); return; } GenerateNewIDs(AssetObjectsEditor.GetAllAssetObjectPaths(pack.dir, pack.extensions, false), pathsWithoutIDs); }
void DrawGenIDsForPack(AssetObjectPack pack) { if (GUIUtils.Button(new GUIContent("Update IDs in Directory"), GUIStyles.button, Colors.selected, Colors.black)) { string msg = "Generating IDs will rename assets without IDs, are you sure?"; if (EditorUtility.DisplayDialog("Generate IDs", msg, "Generate IDs", "Cancel")) { UpdateIDsForPack(pack); } } }
void DrawUpdateIDsButton() { AssetObjectPack displayPack = packsManager.packs[displayPackIndex]; if (!displayPack.isCustom) { GUIUtils.StartBox(); DrawGenIDsForPack(displayPack); GUIUtils.EndBox(); } }