Version: 2017.1

EditorUtility.CompressCubemapTexture

切换到手册
public static void CompressCubemapTexture (Cubemap texture, TextureFormat format, int quality);
public static void CompressCubemapTexture (Cubemap texture, TextureFormat format, TextureCompressionQuality quality);

描述

压缩立方体贴图纹理。

使用此函数将立方体贴图显式压缩为指定格式。

using UnityEngine;
using UnityEditor;

public class CompressCubemapTextureExample : AssetPostprocessor { // Automatically Compress all imported cube map textures to the project to RGB24 void OnPosprocessTexture(Cubemap t) { EditorUtility.CompressCubemapTexture(t, TextureFormat.RGB24, TextureCompressionQuality.Normal); } }