Пример #1
0
        public static void CreateUnityFolder(string childPath)
        {
            var fullPath = UnityPathUtility.GetUnityAbsoluteFolderPath(childPath);

            if (CSharpFileUtility.IsFolderExist(fullPath) == false)
            {
                Directory.CreateDirectory(fullPath);
                RefreshAsset();
            }
        }
Пример #2
0
        public static void SetTextureImporterSetting(string presetPath, string texturePath)
        {
            if (IsFileInPath(texturePath) == false)
            {
                return;
            }
            var preset = AssetDatabase.LoadAssetAtPath <Preset>(presetPath);

            if (preset == null)
            {
                return;
            }

            var presetType            = preset.GetTargetTypeName();
            var textureFileExtenstion = CSharpFileUtility.GetExtensionFromFullPath(texturePath);

            if (presetType == "TextureImporter" && textureFileExtenstion == "png")
            {
                var textureImporter = AssetImporter.GetAtPath(texturePath) as TextureImporter;
                preset.ApplyTo(textureImporter);
                textureImporter.SaveAndReimport();
            }
        }
Пример #3
0
 public static bool IsUnityFolderExist(string childPath)
 {
     return(CSharpFileUtility.IsFolderExist("Assets/" + childPath));
 }
Пример #4
0
        public static bool IsFileInPath(string unityFileFullPath)
        {
            var slashToCsharp = CSharpFileUtility.ParseSlashToCsharp(unityFileFullPath);

            return(CSharpFileUtility.IsFileInPath(slashToCsharp));
        }
Пример #5
0
        public static bool IsFileInPath(string unityFullFolderPath, string fileName, FileType fileType)
        {
            var slashToCsharp = CSharpFileUtility.ParseSlashToCsharp(unityFullFolderPath);

            return(CSharpFileUtility.IsFileInPath(slashToCsharp, fileName, GetExtension(fileType)));
        }
Пример #6
0
 public static string GetCsharpUnityAbsoluteFullPath(string childPath, string fileName, string extension)
 {
     return(CSharpFileUtility.ParseSlashToCsharp(GetUnityAbsoluteFullPath(childPath, fileName, extension)));
 }
Пример #7
0
 public static string GetCsharpUnityAbsoluteFolderPath(string childPath)
 {
     return(CSharpFileUtility.ParseSlashToCsharp(GetUnityAbsoluteFolderPath(childPath)));
 }