From df716cf7f79816bece7a5d4386803a980044f511 Mon Sep 17 00:00:00 2001 From: Boyce Lig <532762848@qq.com> Date: Thu, 17 Mar 2022 18:42:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AD=A6=E5=91=8A=20?= =?UTF-8?q?=E9=87=8D=E5=86=99=E5=B7=B2=E5=BC=83=E7=94=A8SetTextureFormat?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=96=B9=E5=BC=8F=20=E6=8F=90=E5=8D=87unity?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=88=B02018=E6=9C=80=E6=96=B0=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Editor/CreateMoudleFloder.cs | 8 +++---- Assets/MusicsNewPlot.meta | 8 ------- Assets/Scripts/ValueChangeScript.cs | 6 ++--- .../Scripts/CustomTextureImporter.cs" | 24 +++++++++++++++---- Packages/manifest.json | 4 ++-- ProjectSettings/ProjectVersion.txt | 2 +- 6 files changed, 27 insertions(+), 25 deletions(-) delete mode 100644 Assets/MusicsNewPlot.meta diff --git a/Assets/Editor/CreateMoudleFloder.cs b/Assets/Editor/CreateMoudleFloder.cs index 7c4ce98..119ccf5 100644 --- a/Assets/Editor/CreateMoudleFloder.cs +++ b/Assets/Editor/CreateMoudleFloder.cs @@ -1,8 +1,6 @@ -using System.Collections; -using System.Collections.Generic; +using System.IO; using UnityEditor; using UnityEngine; -using System.IO; //用于创建项目模块 //打开一个对话框,输入模块Name,生成一个包含Shader、Scripts、Materials、Textures、Model的文件夹 @@ -10,7 +8,7 @@ public class CreateMoudleFloder : EditorWindow { - private string name; + private new string name; private void OnGUI() { @@ -28,7 +26,7 @@ private static void CreateMoudle() } private static void CreateMoudleFloderWithName(string name) - { + { string moduleString = "Assets/" + name; if (!Directory.Exists(moduleString)) { diff --git a/Assets/MusicsNewPlot.meta b/Assets/MusicsNewPlot.meta deleted file mode 100644 index 9c46b22..0000000 --- a/Assets/MusicsNewPlot.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3bf948cc550b310409027dc0a9cc0de3 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/ValueChangeScript.cs b/Assets/Scripts/ValueChangeScript.cs index 1811524..900f64d 100644 --- a/Assets/Scripts/ValueChangeScript.cs +++ b/Assets/Scripts/ValueChangeScript.cs @@ -1,10 +1,8 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; +using UnityEngine; public class ValueChangeScript : MonoBehaviour { - public string name = "123"; + public new string name = "123"; public int num = 10; //脚本上Reset按钮触发 diff --git "a/Assets/\350\265\204\346\272\220\345\257\274\345\205\245\350\207\252\345\212\250\351\205\215\347\275\256/Scripts/CustomTextureImporter.cs" "b/Assets/\350\265\204\346\272\220\345\257\274\345\205\245\350\207\252\345\212\250\351\205\215\347\275\256/Scripts/CustomTextureImporter.cs" index 856a1d9..2bcef32 100644 --- "a/Assets/\350\265\204\346\272\220\345\257\274\345\205\245\350\207\252\345\212\250\351\205\215\347\275\256/Scripts/CustomTextureImporter.cs" +++ "b/Assets/\350\265\204\346\272\220\345\257\274\345\205\245\350\207\252\345\212\250\351\205\215\347\275\256/Scripts/CustomTextureImporter.cs" @@ -26,9 +26,16 @@ void OnPreprocessTexture() //设置plan2 TextureImporterPlatformSettings settings = textureImporter.GetPlatformTextureSettings("Android"); - if(settings.format != TextureImporterFormat.RGBA32 && settings.format != TextureImporterFormat.ETC2_RGBA8) + if (settings.format != TextureImporterFormat.RGBA32 && settings.format != TextureImporterFormat.ETC2_RGBA8) { - textureImporter.SetPlatformTextureSettings("Android", 2048, TextureImporterFormat.ETC2_RGBA8, true); + settings.maxTextureSize = 2048; + settings.format = TextureImporterFormat.ETC2_RGBA8; + settings.allowsAlphaSplitting = true; + textureImporter.SetPlatformTextureSettings(settings); + + //已弃用用上面方法 + //textureImporter.SetPlatformTextureSettings("Android", 2048, TextureImporterFormat.ETC2_RGBA8, true); + } } } @@ -36,13 +43,20 @@ void OnPreprocessTexture() [MenuItem("Assets/手动设置贴图格式", false, -1)] static void SetTextureFormat() { - if(Selection.assetGUIDs.Length > 0) + if (Selection.assetGUIDs.Length > 0) { AssetImporter importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(Selection.activeObject)); - if(importer is TextureImporter) + if (importer is TextureImporter) { - (importer as TextureImporter).SetPlatformTextureSettings("Standalone", 2048, TextureImporterFormat.RGBA32, true); + TextureImporterPlatformSettings standalone = (importer as TextureImporter).GetPlatformTextureSettings("Standalone"); + standalone.maxTextureSize = 2048; + standalone.format = TextureImporterFormat.RGBA32; + standalone.allowsAlphaSplitting = true; + (importer as TextureImporter).SetPlatformTextureSettings(standalone); + + //已弃用用上面方法 + //(importer as TextureImporter).SetPlatformTextureSettings("Standalone", 2048, TextureImporterFormat.RGBA32, true); importer.SaveAndReimport(); } } diff --git a/Packages/manifest.json b/Packages/manifest.json index ddf67b4..458e600 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -2,9 +2,9 @@ "dependencies": { "com.unity.ads": "2.0.8", "com.unity.analytics": "3.2.3", - "com.unity.collab-proxy": "1.2.15", + "com.unity.collab-proxy": "1.2.16", "com.unity.package-manager-ui": "2.0.13", - "com.unity.purchasing": "2.0.3", + "com.unity.purchasing": "2.2.2", "com.unity.textmeshpro": "1.4.1", "com.unity.modules.ai": "1.0.0", "com.unity.modules.animation": "1.0.0", diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index ef4a753..ff8802c 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1 +1 @@ -m_EditorVersion: 2018.4.20f1 +m_EditorVersion: 2018.4.36f1