Version: 2020.1
材质
Material Inspector 参考

材质简介

To draw something in Unity, you must provide information that describes its shape, and information that describes the appearance of its surface. You use meshes to describe shapes, and materials to describe surfaces.

Materials and shaders are closely linked. In Unity, a material contains a reference to a Unity shader, and data (such as colors or textures) that the Unity shader uses. You use materials and Unity shaders together to define the appearance of surfaces in your scene.

本页包含以下信息:

渲染管线兼容性

功能 内置渲染管线 通用渲染管线 (URP) 高清渲染管线 (HDRP) 自定义可编程渲染管线 (SRP)
材质

材质基础知识

A material contains a reference to a Unity shader. It can also contain data for the Unity shader, such as textures or colors.

The Material class represents a material in C# code. For information on using the Material class, see Using Materials with C# scripts.

A material asset represents a material in your Unity project. If the Unity shader assigned to a material asset defines material properties, then the data for those properties is saved as part of the material asset. This means that you can view and edit material properties using the Inspector window. For information on viewing and editing a material using the Inspector window, see Material Inspector reference.

Creating a material asset and assigning a Unity shader to it

  1. 要在项目中创建新材质资源,请从主菜单或 Project 视图上下文菜单中选择 Assets > Create > Material
  2. To change the default Unity shader that is assigned to a material asset, in the Inspector window use the Shader drop-down menu.

将材质资源分配给游戏对象

使用材质渲染游戏对象:

  1. 添加一个从 Renderer 继承的组件。MeshRenderer 是最常见的,适用于大多数用例,但如果游戏对象有特殊要求,SkinnedMeshRendererLineRendererTrailRenderer 可能更合适。
  2. 将材质资源分配给组件的 Material 属性。

使用材质渲染内置粒子系统中的粒子系统:

  1. 添加一个渲染器模块到粒子系统。
  2. 将材质资源分配给渲染模块的 Material 属性。
材质
Material Inspector 参考