Class TextureCombiner
Namespace: UnityEditor.Rendering
Syntax
public class TextureCombiner
Constructors
TextureCombiner(Texture, Int32, Texture, Int32, Texture, Int32, Texture, Int32, Boolean)
Creates a TextureCombiner object.
Declaration
public TextureCombiner(Texture rSource, int rChanel, Texture gSource, int gChanel, Texture bSource, int bChanel, Texture aSource, int aChanel, bool bilinearFilter = true)
Parameters
Type | Name | Description |
---|---|---|
Texture | rSource | Source Texture for the RED output. |
Int32 | rChanel | Channel index to use for the RED output. |
Texture | gSource | Source Texture for the GREEN output. |
Int32 | gChanel | Channel index to use for the GREEN output. |
Texture | bSource | Source Texture for the BLUE output. |
Int32 | bChanel | Channel index to use for the BLUE output. |
Texture | aSource | Source Texture for the ALPHA output. |
Int32 | aChanel | Channel index to use for the ALPHA output. |
Boolean | bilinearFilter | Use bilinear filtering when combining (default = true). |
Properties
midGrey
Returns a 1 by 1 mid grey (0.5, 0.5, 0.5, 1) Texture.
Declaration
public static Texture2D midGrey { get; }
Property Value
Type | Description |
---|---|
Texture2D |
Methods
Combine(String)
Process the TextureCombiner. Unity creates the Texture Asset at the "savePath", and returns the Texture object.
Declaration
public Texture2D Combine(string savePath)
Parameters
Type | Name | Description |
---|---|---|
String | savePath | The path to save the Texture Asset to, relative to the Project folder. |
Returns
Type | Description |
---|---|
Texture2D |
GetTextureSafe(Material, String, Color)
Returns the Texture assigned to the property "propertyName" of "srcMaterial". If no matching property is found, or no Texture is assigned, returns a 1 by 1 Texture of "fallback" color.
Declaration
public static Texture GetTextureSafe(Material srcMaterial, string propertyName, Color fallback)
Parameters
Type | Name | Description |
---|---|---|
Material | srcMaterial | The Material to get the Texture from. |
String | propertyName | The name of the Texture property. |
Color | fallback | The fallback color that Unity uses to create a Texture if it could not find the Texture property on the Material. |
Returns
Type | Description |
---|---|
Texture |
GetTextureSafe(Material, String, Texture)
Returns the Texture assigned to the property "propertyName" of "srcMaterial". If no matching property is found, or no Texture is assigned, returns the "fallback" Texture.
Declaration
public static Texture GetTextureSafe(Material srcMaterial, string propertyName, Texture fallback)
Parameters
Type | Name | Description |
---|---|---|
Material | srcMaterial | The Material to get the Texture from. |
String | propertyName | The name of the Texture property. |
Texture | fallback | The fallback color that Unity uses to create a Texture if it could not find the Texture property on the Material. |
Returns
Type | Description |
---|---|
Texture |
SetRemapping(Int32, Single, Single)
Set the remapping of a specific color channel.
Declaration
public void SetRemapping(int channel, float min, float max)
Parameters
Type | Name | Description |
---|---|---|
Int32 | channel | Target color channel (Red:0, Green:1, Blue:2, Alpha:3). |
Single | min | Minimum input value mapped to 0 in output. |
Single | max | Maximum input value mapped to 1 in output. |
TextureFromColor(Color)
Returns a 1 by 1 Texture that is the color that you pass in.
Declaration
public static Texture2D TextureFromColor(Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color that Unity uses to create the Texture. |
Returns
Type | Description |
---|---|
Texture2D |
TextureHasAlpha(Texture2D)
Specifies whether the Texture has an alpha channel or not. Returns true if it does and false otherwise.
Declaration
public static bool TextureHasAlpha(Texture2D tex)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | tex | The Texture for this function to check. |
Returns
Type | Description |
---|---|
Boolean |