Texture2D
Unity Texture2D class extern binding for Ceramic. Represents a 2D texture asset that can be used for rendering.
This binding provides essential properties and methods for texture manipulation, including pixel data access and render-to-texture capabilities used by the Ceramic backend.
Instance Members
Width of the texture in pixels. Read-only property set when the texture is created.
Height of the texture in pixels. Read-only property set when the texture is created.
Filtering mode of the texture. Controls how the texture is sampled when transformed. Point = nearest neighbor (pixelated), Bilinear/Trilinear = smooth.
SetPixelData(data: cs.NativeArray<cs.types.UInt8>, mipLevel: Int, sourceDataStartIndex: Int): Void
Sets raw pixel data for the texture from a byte array. The data must be in the correct format for the texture.
Name | Type | Description |
---|---|---|
data |
cs.NativeArray<cs.types.UInt8> | Raw pixel data as a native byte array |
mipLevel |
Int | Mipmap level to write to (0 = full resolution) |
sourceDataStartIndex |
Int | Starting index in the source data array |
Reads pixels from the current render target into this texture. Commonly used to capture the screen or render texture contents.
Name | Type | Description |
---|---|---|
source |
Rect | Rectangle in screen coordinates to read from |
destX |
Int | X coordinate in the texture to write to |
destY |
Int | Y coordinate in the texture to write to |
recalculateMipMaps |
Bool | Whether to update mipmaps after reading |
Applies all previous SetPixel and SetPixels changes. Must be called to upload changed pixels to the GPU.
Name | Type | Description |
---|---|---|
updateMipmaps |
Bool | Whether to recalculate mipmaps |
makeNoLongerReadable |
Bool | If true, frees CPU memory copy (saves memory but prevents further CPU access) |
Metadata
Name | Parameters |
---|---|
:nativeGen |
- |