-
-
Save kirillrybin/5262521 to your computer and use it in GitHub Desktop.
В Unity3D cохраняет текстуру в файл
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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