Version: 2021.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 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.

This page contains the following information:

Render pipeline compatibility

Característica Built-in Render Pipeline Universal Render Pipeline (URP) High Definition Render Pipeline (HDRP) Custom Scriptable Render Pipeline (SRP)
Materiales

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 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. 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 GameObject 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 system 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