private bool JudgeTransparentPic(TextureFormat format)
{
//所有贴图格式带alpha通道的格式,带alpha通道的贴图才为透明贴图
string[] transparentFormat =
{
TextureFormat.Alpha8.ToString(),TextureFormat.ARGB32.ToString(),
TextureFormat.ARGB4444.ToString(),TextureFormat.ATC_RGBA8.ToString(),
TextureFormat.ATF_RGBA_JPG.ToString(),TextureFormat.BGRA32.ToString(),
TextureFormat.PVRTC_RGBA2.ToString(),TextureFormat.PVRTC_RGBA4.ToString(),
TextureFormat.RGBA32.ToString(),TextureFormat.RGBA4444.ToString(),
};
string selfFormat = format.ToString();
for (int i = 0; i < transparentFormat.Length; i++)
{
if (selfFormat == transparentFormat[i])
{
return true;
}
}
return false;
}
【Unity实用小方法】判断贴图是否为透明贴图
最新推荐文章于 2025-03-01 17:28:25 发布