Select your preferred scripting language. All code snippets will be displayed in this language.
class in UnityEngine
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.Close
For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.Close
Class for handling Sparse Textures.
Sparse textures are textures where not the whole texture data can be present in memory at once. They are also commonly called "tiled textures" or "mega textures".
Imagine a 16384x16384 texture at 32 bits per pixel - it would take 1GB of memory. The texture is broken down into rectangular "tiles", and each tile can either be present in memory or not. You can load & unload these tiles as needed based on distance from the camera, sectors of the world that the player has to see, etc.
Otherwise, the sparse textures behave just like any other texture in shaders - they can have mipmaps, can use all texture filtering modes, etc. If you happen to read from a tile that's not present, you can get undefined result (on many GPUs the result is a black color, but that's not guaranteed).
Note that not all hardware and platforms support sparse textures, so you should check SystemInfo.supportsSparseTextures before using them. For example, on DirectX systems they require DX11.2 (Windows 8.1) and a fairly recent GPU; and on OpenGL they require ARB_sparse_texture extension support.
After creating the sparse texture, query the tile size with tileWidth & tileHeight. Tile sizes are platform and GPU dependent.
Use UpdateTile or UpdateTileRaw to make a tile resident in memory and update its color data. Use UnloadTile to unload a tile.
See Also: Sparse Textures documentation page.
|isCreated||Is the sparse texture actually created? (Read Only)|
|tileHeight||Get sparse texture tile height (Read Only).|
|tileWidth||Get sparse texture tile width (Read Only).|
|SparseTexture||Create a sparse texture.|
|UnloadTile||Unload sparse texture tile.|
|UpdateTile||Update sparse texture tile with color values.|
|UpdateTileRaw||Update sparse texture tile with raw pixel values.|
|hideFlags||Should the object be hidden, saved with the scene or modifiable by the user?|
|name||The name of the object.|
|anisoLevel||Anisotropic filtering level of the texture.|
|dimension||Dimensionality (type) of the texture (Read Only).|
|filterMode||Filtering mode of the texture.|
|height||Height of the texture in pixels. (Read Only)|
|mipMapBias||Mip map bias of the texture.|
|width||Width of the texture in pixels. (Read Only)|
|wrapMode||Wrap mode (Repeat or Clamp) of the texture.|
|GetInstanceID||Returns the instance id of the object.|
|ToString||Returns the name of the game object.|
|GetNativeTexturePtr||Retrieve a native (underlying graphics API) pointer to the texture resource.|
|Destroy||Removes a gameobject, component or asset.|
|DestroyImmediate||Destroys the object obj immediately. You are strongly recommended to use Destroy instead.|
|DontDestroyOnLoad||Makes the object target not be destroyed automatically when loading a new scene.|
|FindObjectOfType||Returns the first active loaded object of Type type.|
|FindObjectsOfType||Returns a list of all active loaded objects of Type type.|
|Instantiate||Clones the object original and returns the clone.|
|SetGlobalAnisotropicFilteringLimits||Sets Anisotropic limits.|