Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Texture

Base class for Texture handling.
Read time 6 minutesLast updated 2 days ago

Definition

  • Type: Class
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
  • Inherits from: Object
public class Texture : Object

Static Fields

Value

Description

GenerateAllMipsCan be used with Texture constructors that take a mip count to indicate that all mips should be generated. The value of this field is -1.

Properties

Property

Description

anisoLevelDefines the anisotropic filtering level of the Texture.
dimensionDimensionality (type) of the Texture.
filterModeFiltering mode of the Texture.
graphicsFormatReturns the GraphicsFormat format or color format of a Texture object.
graphicsTextureGraphicsTexture that represents the texture resource uploaded to the graphics device.
heightHeight of the Texture in pixels.
imageContentsHashThe hash value of the Texture.
isDataSRGBReturns
true
if the texture pixel data is in sRGB color space.
isReadableWhether Unity stores an additional copy of this texture's pixel data in CPU-addressable memory.
mipMapBiasThe mipmap bias of the Texture.
mipmapCountHow many mipmap levels are in this Texture.
updateCountThis counter is incremented when the Texture is updated.
widthWidth of the Texture in pixels.
wrapModeOptions for sampling a texture if a texture coordinate is outside the [0, 1] range.
wrapModeUOptions for sampling a texture if the U texture coordinate is outside the [0, 1] range.
wrapModeVOptions for sampling a texture if the V texture coordinate is outside the [0, 1] range.
wrapModeWOptions for sampling a texture if the W coordinate is outside the [0, 1] range.

Static Properties

Property

Description

allowThreadedTextureCreationAllow Unity internals to perform Texture creation on any thread (rather than the dedicated render thread).
currentTextureMemoryThe amount of memory that all Textures in the scene use.
desiredTextureMemoryThe total amount of texture memory, in bytes, that Unity would use if no constraints are applied.
nonStreamingTextureCountThe number of non-streaming Textures in the scene. This includes instances of Texture2D and CubeMap Textures. This does not include any other Texture types, or 2D and CubeMap Textures that Unity creates internally.
nonStreamingTextureMemoryThe amount of memory Unity allocates for non-streaming Textures in the scene. This only includes instances of Texture2D and CubeMap Textures. This does not include any other Texture types, or 2D and CubeMap Textures that Unity creates internally.
streamingMipmapUploadCountHow many times has a Texture been uploaded due to Texture mipmap streaming.
streamingRendererCountNumber of renderers registered with the Texture streaming system.
streamingTextureCountNumber of streaming Textures.
streamingTextureDiscardUnusedMipsThis property forces the streaming Texture system to discard all unused mipmaps instead of caching them until the Texture memory budget is exceeded. This is useful when you profile or write tests to keep a predictable set of Textures in memory.
streamingTextureForceLoadAllForce streaming Textures to load all mipmap levels.
streamingTextureLoadingCountNumber of streaming Textures with mipmaps currently loading.
streamingTexturePendingLoadCountNumber of streaming Textures with outstanding mipmaps to be loaded.
targetTextureMemoryTotal texture memory usage in bytes after applying the memory budget and loading all textures.
totalTextureMemoryThe total texture memory, in bytes, that Unity would use if all textures are loaded at full resolution.

Methods

Method

Description

GetNativeTexturePtrRetrieve a native (underlying graphics API) pointer to the Texture resource.
IncrementUpdateCountIncrement the update counter.

Static Methods

Method

Description

SetGlobalAnisotropicFilteringLimitsSets Anisotropic limits.
SetStreamingTextureMaterialDebugPropertiesThis function sets mipmap streaming debug properties on all materials known by the mipmap streaming system.

Inheritance

Inherited Members

Operators

Operator

Description

operator ==Compares two object references to see if they refer to the same object.
boolDetermines whether the object exists.
operator !=Compares if two objects refer to a different object.