Version: 2022.3
  • C#


Suggest a change


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.


Submission failed

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.



Switch to Manual


public static int PropertyToID(string name);


name Shader property name.


int Unique integer for the name.


Gets unique identifier for a shader property name.

Using property identifiers is more efficient than passing strings to all material property functions. For example if you are calling Material.SetColor a lot, or using MaterialPropertyBlock, then it is better to get the identifiers of the properties you need just once.

Each name of shader property (for example, _MainTex or _Color) is assigned an unique integer number in Unity, that stays the same for the whole game. The numbers will not be the same between different runs of the game or between machines, so do not store them or send them over network.

Additional resources: Material, MaterialPropertyBlock.