要在 Unity 中绘制某物,您必须提供描述其形状的信息以及描述其表面外观的信息。使用网格可描述形状,使用材质可描述表面的外观。
材质和着色器紧密相连;总是通过着色器使用材质。
本页包含以下信息:
功能 | 内置渲染管线 | 通用渲染管线 (URP) | 高清渲染管线 (HDRP) | 自定义可编程渲染管线 (SRP) |
---|---|---|---|---|
材质 | 是 | 是 | 是 | 是 |
材质包含对 Shader 对象的引用。如果 Shader 对象定义材质属性,则材质还可以包含数据(如颜色或纹理参考等)。
Material 类表示 C# 代码中的材质。有关信息,请参阅在 C# 脚本中使用材质。
A material asset is a file with the .mat
extension. It represents a material in your Unity project. For information on viewing and editing a material asset using the Inspector window, see Material Inspector reference.
使用材质渲染游戏对象:
Renderer
继承的组件。MeshRenderer 是最常见的,适用于大多数用例,但如果游戏对象有特殊要求,SkinnedMeshRenderer、LineRenderer 或 TrailRenderer 可能更合适。使用材质渲染内置粒子系统中的粒子系统:
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.