unity3d 代碼設置貼圖Read/Write Enable屬性


   [MenuItem("Image/SetReadWriteTrue")]
     static void SetReadWriteTrue() {
         Debug.LogWarning("開始");
         Object[] selectedAsset = Selection.GetFiltered(typeof(Texture), SelectionMode.DeepAssets);
         for(int i = 0; i < selectedAsset.Length; i++) {
             Texture2D tex = selectedAsset[i] as Texture2D;
             TextureImporter ti = (TextureImporter)TextureImporter.GetAtPath(AssetDatabase.GetAssetPath(tex));
             ti.isReadable = true;
             AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(tex));
         }
         Debug.LogWarning("結束");

     }


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章