您的位置:首页 > 移动开发 > Unity3D

unity3d 代码设置贴图Read/Write Enable属性

2015-11-28 17:36 806 查看
[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("结束");

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: