Version: 2018.1
public static int PropertyToID (string name);

パラメーター

nameシェーダープロパティー名

戻り値

int 名前に使用する固有の整数

説明

シェーダープロパティー名からユニーク ID を取得します

すべてのマテリアルプロパティー関数に文字列を渡すよりもユニーク ID を使用したほうが効率的です。例えばもし Material.SetColor を何度も呼び出したり MaterialPropertyBlock を使用する場合は、必要なプロパティーのユニーク ID を一度だけ取得する方が効率的です。

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.

See Also: Material, MaterialPropertyBlock.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961