Skip to content

Texture2D Extensions

Andrzej Kebab edited this page Feb 2, 2024 · 1 revision

Unity Runtime Utility Library

Texture2DExtensions

LoadFromFile

Loads a Texture2D from a file.

Texture2D texture2D = // Your Texture2D instance;
string path = // Path to the file;
texture2D.LoadFromFile(path);

Parameters:

  • texture2D: The Texture2D instance.
  • path: The path to the file.

SaveToFile

Saves a Texture2D to a file (Default format: PNG).

Texture2D texture2D = // Your Texture2D instance;
string path = // Path to the file;
texture2D.SaveToFile(path);

Parameters:

  • texture2D: The Texture2D instance.
  • path: The path to the file.

SaveToFileExr

Saves a Texture2D to an EXR file.

Texture2D texture2D = // Your Texture2D instance;
string path = // Path to the file;
texture2D.SaveToFileExr(path);

Parameters:

  • texture2D: The Texture2D instance.
  • path: The path to the file.

SaveToFileTga

Saves a Texture2D to a TGA file.

Texture2D texture2D = // Your Texture2D instance;
string path = // Path to the file;
texture2D.SaveToFileTga(path);

Parameters:

  • texture2D: The Texture2D instance.
  • path: The path to the file.

SaveToFileJpg

Saves a Texture2D to a JPG file.

Texture2D texture2D = // Your Texture2D instance;
string path = // Path to the file;
texture2D.SaveToFileJpg(path);

Parameters:

  • texture2D: The Texture2D instance.
  • path: The path to the file.

SaveToFilePng

Saves a Texture2D to a PNG file.

Texture2D texture2D = // Your Texture2D instance;
string path = // Path to the file;
texture2D.SaveToFilePng(path);

Parameters:

  • texture2D: The Texture2D instance.
  • path: The path to the file.

Clone this wiki locally