IEnumerator fImageDownCheck() {
WWW www = new WWW(_url);
yield return www;
if(www.size == 0) {
mImage = true;
StopCoroutine("fImageDownCheck");
} else {
noticeManager.fNoticeTextureMake(www.texture);
Debug.Log("Image Save");
// Texture2D savedTexture = _materialToSave.mainTexture as Texture2D;
Texture2D newTexture = new Texture2D(www.texture.width, www.texture.height, TextureFormat.ARGB32, false);
newTexture.SetPixels(0,0, www.texture.width, www.texture.height, www.texture.GetPixels());
newTexture.Apply();
byte[] bytes = newTexture.EncodeToPNG();
Debug.Log(bytes);
File.WriteAllBytes(Application.temporaryCachePath+"/"+"test.png", bytes);
}
}
Application.temporaryCachePath 폴더 : /var/folders/dy/********************/T/DefaultCompany/ProjectName
에 저장 됩니다.