unity在Color Space模式设置为Linear时问题来了
不管是网上加载的图片还是本地加载的图片都出现了泛白的问题(如下图)
原图
加载出来的图
很明显加载的图片像贴了一层膜
怎么解决?
把你获得到的图片Texture进行一个格式的转换
使用TextureFormat.RGB24格式是肯定没问题的,别的格式可以自己尝试。
public RawImage MainImage;
public void Fun(Texture2D texture){
Texture2D texture2 = new Texture2D(texture.width,texture.height,TextureFormat.RGB24,true);
texture2.LoadImage(texture.EncodeToPNG());
MainImage.texture = texture2;
}