PropertyToID(string)
Gets unique identifier for a shader property name.
Read time 1 minuteLast updated 8 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
public static int PropertyToID(string name)
Parameters
Shader property name.
Returns
Type | Description |
|---|---|
| int | Unique integer for the name. |
Remarks
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.
Unity assigns a unique integer to each shader property name, for example or . The integer stays the same while the game runs, but it differs between runs and between machines, so don't store it or send it over a network.
_BaseMap_BaseColorAdditional Resources: Material, MaterialPropertyBlock.