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
The hash value of the Texture.
The hash value is a 128-bit number computed in such a way that even slightly different textures have different hash values. The principal use of the hash in this case is to detect when the texture has changed. Unity updates the hash when changing or rendering into a texture. Likewise, you must calculate a new hash when modifying the texture contents so that Unity knows when the texture changes. Changing the hash lets the Global Illumination system know that it needs to recalculate maps in the scene that are affected by the texture.
For regular textures, Unity first computes the hash when the texture is imported into the Editor, and updates the hash after light and reflections are "baked" into the texture. If you subsequently render into a texture which is used as an input for the Global Illumination system (such as sky, light or reflection probes), then you must update the texture hash yourself. Note that the hash is an Editor-only property.
Note that calculating the hash using the pixel values of the texture might be inefficient or impossible. Instead, you could hash the input parameters to the code you use to create the texture. The important thing is that resulting hash is different for different textures (and the same for the identical textures).
Did you find this page useful? Please give it a rating: