Assetsフォルダ外の外部に置かれたCMYK画像を読み込むとこのように『?』と表示され表示できません。(※Unity5.4.2f2で確認)
コードはこんな感じで書いています。
| 
					 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  | 
						void Start () { 	string imagePath = Application.dataPath + "/../cmyk.jpg"; 	print (imagePath); 	Texture2D tex = new Texture2D(0,0); 	tex.LoadImage(LoadBin(imagePath)); 	gameObject.GetComponent<Renderer>().material.mainTexture = tex; } byte[] LoadBin(string path){ 	FileStream fs = new FileStream(path, FileMode.Open); 	BinaryReader br = new BinaryReader(fs); 	byte[] buf = br.ReadBytes( (int)br.BaseStream.Length); 	br.Close(); 	return buf; }  | 
					
画像をPhotoshopでCMYKからRGBに変更するとこのようにちゃんと表示されるようになりました。
ちなみに外部読み込みでなくCMYK画像をAssetsフォルダに入れるとEditor読み込み時に自動的にRGBに変換されていました。その点注意が必要かも。
		        
							
														
						
							
														
						



					
				


コメントを残す