Use this API to override the default settings in the Mipmap Streaming system, or get more fine-grained control.
This page contains the following information:
For general information about this system, see Mipmap Streaming system.
You can use the API to override behavior for specific situations, while the Mipmap Streaming system automatically manages the default settings.
This is useful if you know that Unity needs to fully load certain textures; for example, if they relate to GameObjectsThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary that move large distances quickly, or if you use instantaneous cameraA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
See in Glossary cuts.
To enable and control Mipmap Streaming on a texture, use the following properties:
Mipmap Streaming automatically reduces the mip level of textures until they fit into the Mipmap Streaming Memory Budget. The Texture’s Mip Map Priority number is roughly a mipmap offset for the Memory Budget. For example, with a priority of 2, the Mipmap Streaming system tries to use a mip that is two mip levels higher than other textures with a priority of 0. Negative values are also valid. If it can’t do this, it uses a lower mip level to fit the Memory Budget.
These properties are read-only at runtime:
To control what happens at runtime, use the following static properties:
When cutting from one location to another, the Mipmap Streaming system needs time to stream the required Textures into Unity. To trigger preloading at a disabled target Camera location, call StreamingController.SetPreloading on the target Camera’s Streaming Controller component. You can specify a time-out to end the preloading phase. To automatically enable the Camera at the end of the preloading phase, set the activateCameraOnTimeout
flag to true in script. To disable a Camera after you cut from it to the new one, pass that Camera as the disableCameraCuttingFrom
parameter.
void StreamingController.SetPreloading(float timeoutSeconds=0.0f, bool activateCameraOnTimeout=false, Camera disableCameraCuttingFrom=null)
To cancel or query the preloading state, use the following methods:
To determine whether the Mipmap Streaming system is still loading Textures, you can query the following properties:
Note that there is delay between when you enable a Camera and when these properties become a value other than zero. This delay is because the Mipmap Streaming system calculates the mip maps using time-sliced processing. For this reason, during a Camera cut you should wait a minimum length of time before the cut. Texture budget and SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary movement can cause continuous Mipmap Streaming, so you also need to set a maximum length of time before the cut.
To override the mip level calculation for a specific Texture, use Texture2D.requestedMipmapLevel. This is an exact mip level ranging from 0 to the maximum mip level of the specific Texture, or the Max Level Reduction value if that is lower. 0 is the highest resolution mip.
To check if your requested mip level has loaded, use Texture2D.IsRequestedMipmapLevelLoaded.
If you no longer want to override the mip level you requested and instead want the system to continue to calculate mip levels, use Texture2D.ClearRequestedMipmapLevel to reset the value.
To get an estimate of the UV density on a MeshThe main graphics primitive of Unity. Meshes make up a large part of your 3D worlds. Unity supports triangulated or Quadrangulated polygon meshes. Nurbs, Nurms, Subdiv surfaces must be converted to polygons. More info
See in Glossary, use the following:
float Mesh.GetUVDistributionMetric(int uvSetIndex)
You can use the UV distribution metric to calculate the mipmap level you need, based on the position of the Camera. See Mesh.GetUVDistributionMetric for example code.
To override the system and force all mips to load, use Texture.streamingTextureForceLoadAll.
To get per-texture streaming info in material properties that can be used for creating debug visualisations use Texture.SetStreamingTextureMaterialDebugProperties.
You can use Texture.SetStreamingTextureMaterialDebugProperties to assign streaming status information for each texture to material properties. You can then use these properties in the shaderA program that runs on the GPU. More info
See in Glossary to create debug visualizations.
You can also use these properties to create Mipmap Streaming profiling and debugging tools for your project.
To get information about the number of Textures or renderers the Mipmap Streaming system is interacting with, use the following properties:
To get information about mipmap levels for a texture, use the following properties:
To get and set a Texture assigned to a Material, use:
To get all Texture properties on a Material, use:
When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
More information
These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising. Some 3rd party video providers do not allow video views without targeting cookies. If you are experiencing difficulty viewing a video, you will need to set your cookie preferences for targeting to yes if you wish to view videos from these providers. Unity does not control this.
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.