Example #1
0
    static void LoadMDL()
    {
        string path      = AssetUtils.GetAbsoluteAssetPath("Assets/Editor/Data/progs");
        string modelsDir = "Assets/Models";

        var files = ListModelFiles(path, "*.mdl", "*.bsp");
        int index = 0;

        try
        {
            foreach (var file in files)
            {
                float progress = ((float)++index) / files.Count;
                if (EditorUtility.DisplayCancelableProgressBar("Generating models", UnityEditor.FileUtil.GetProjectRelativePath(file), progress))
                {
                    break;
                }

                GenerateModel(FileUtilEx.FixOSPath(file), modelsDir);
            }
        }
        finally
        {
            EditorUtility.ClearProgressBar();
        }
    }
Example #2
0
    public static bool AssetPathExists(string path)
    {
        if (!Path.IsPathRooted(path))
        {
            if (IsValidRelativeAssetPath(path))
            {
                path = Path.Combine(projectPath, FileUtilEx.FixOSPath(path));
            }
            else
            {
                throw new ArgumentException("Illegal asset path: " + path);
            }
        }

        return(Directory.Exists(path) || File.Exists(path));
    }