TextureExtensions.Sample

Extension Method in TextureExtensions

Declaration

public static Color Sample(this Texture2D texture, float u, float v)

Parameters

texture
u
v

Returns

Color

Overload

Declaration

public static Color Sample(this Texture2D texture, Rect rect, Vector2 point)

Description

Gets the pixel color at the UV coordinates calculated from a point inside a rectangle.

Parameters

textureThe texture to sample from.
rectThe rectangle to sample from.
pointThe point inside the rectangle.

Returns

ColorThe pixel color.

Overload

Declaration

public static Color Sample(this Texture2D texture, Bounds bounds, Vector3 position)

Description

Gets the pixel color at the UV coordinates calculated from a position inside a bounds. The position uses the x and z axis.

Parameters

textureThe texture to sample from.
boundsThe bounds to sample from.
positionThe position inside the bounds.

Returns

ColorThe pixel color.