Version: 2020.1
Materials
Material Inspector reference

Materials introduction

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 shadersA small script that contains the mathematical calculations and algorithms for calculating the Color of each pixel rendered, based on the lighting input and the Material configuration. More info
See in Glossary
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 sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
.

This page contains the following information:

Render pipeline compatibility

Feature Built-in Render Pipeline Universal Render Pipeline (URP) High Definition Render Pipeline (HDRP) Custom Scriptable Render Pipeline (SRP)
Materials Yes Yes Yes Yes

Material fundamentals

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

The MaterialAn asset that defines how a surface should be rendered, by including references to the Textures it uses, tiling information, Color tints and more. The available options for a Material depend on which Shader the Material is using. More info
See in Glossary
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 InspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
See in Glossary
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. To create a new material asset in your project, from the main menu or the Project View context menu, select 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.

Assigning a material asset to a GameObject

To render a GameObjectThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary
using a material:

  1. Add a component that inherits from Renderer. MeshRenderer is the most common and is suitable for most use cases, but SkinnedMeshRenderer, LineRenderer, or TrailRenderer might be more suitable if your GameObject has special requirements.
  2. Assign the material asset to the component’s Material property.

To render a particle systemA component that simulates fluid entities such as liquids, clouds and flames by generating and animating large numbers of small 2D images in the scene. More info
See in Glossary
in the Built-in Particle System using a material:

  1. Add a Renderer Module to the Particle System.
  2. Assign the material asset to the Renderer Module’s Material property.
Materials
Material Inspector reference
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961