Skip to content

Instantly share code, notes, and snippets.

@kirillrybin
Created March 28, 2013 11:35
Show Gist options
  • Save kirillrybin/5262521 to your computer and use it in GitHub Desktop.
Save kirillrybin/5262521 to your computer and use it in GitHub Desktop.
В Unity3D cохраняет текстуру в файл
void SaveTextureToFile(Texture2D tex, string fileName){
byte[] bytes = tex.EncodeToPNG();
System.IO.FileStream file = System.IO.File.Open(Application.dataPath + "/" + fileName, System.IO.FileMode.Create);
System.IO.BinaryWriter binary = new System.IO.BinaryWriter(file);
binary.Write(bytes);
file.Close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment