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:
Característica | Built-in Render Pipeline | Universal Render Pipeline (URP) | High Definition Render Pipeline (HDRP) | Custom Scriptable Render Pipeline (SRP) |
---|---|---|---|---|
Materiales | Sí | Sí | Sí | Sí |
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.
To render a GameObject using a material:
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.To render a particle system in the Built-in Particle System using a material: