기술 자료

Unity Engine


User Manual

Script Reference

Unity Engine


Access material properties in a script

Use the MaterialProperty API to access material properties.
읽는 시간 1분최근 업데이트: 25일 전

Material properties are represented in C# code by the MaterialProperty class.
To access variables defined in your HLSL code, you can call Material.GetFloat, Material.SetFloat. There are other, similar methods; see the Material API documentation for a full list. When you access HLSL variables using these APIs, it doesn't matter whether the variable is a material property or not.