Class TextureUtils
Utility class for loading and creating textures at runtime.
public static class TextureUtils
- Inheritance
-
TextureUtils
- Inherited Members
Methods
LoadTextureFromBytes(byte[], FilterMode, TextureWrapMode)
Loads a texture from a byte array.
public static Texture2D LoadTextureFromBytes(byte[] imageData, FilterMode filterMode = 1, TextureWrapMode wrapMode = 1)
Parameters
imageDatabyte[]The image data bytes.
filterModeFilterModeThe filter mode for the texture.
wrapModeTextureWrapModeThe wrap mode for the texture.
Returns
- Texture2D
The loaded texture, or null if loading failed.
LoadTextureFromFile(string, FilterMode, TextureWrapMode)
Loads a texture from a file path.
public static Texture2D LoadTextureFromFile(string filePath, FilterMode filterMode = 1, TextureWrapMode wrapMode = 1)
Parameters
filePathstringThe path to the image file.
filterModeFilterModeThe filter mode for the texture.
wrapModeTextureWrapModeThe wrap mode for the texture.
Returns
- Texture2D
The loaded texture, or null if loading failed.
LoadTextureFromResource(Assembly, string, FilterMode, TextureWrapMode)
Loads a texture from an embedded resource.
public static Texture2D LoadTextureFromResource(Assembly assembly, string resourceName, FilterMode filterMode = 1, TextureWrapMode wrapMode = 1)
Parameters
assemblyAssemblyThe assembly containing the embedded resource.
resourceNamestringThe fully qualified name of the embedded resource.
filterModeFilterModeThe filter mode for the texture.
wrapModeTextureWrapModeThe wrap mode for the texture.
Returns
- Texture2D
The loaded texture, or null if loading failed.