Y
Y
Yugg02020-06-26 20:21:05
Unity
Yugg0, 2020-06-26 20:21:05

How to replace material in Renderer.materials in Unity3d?

The Mesh Renderer has a materials component.
5ef62d68590d7336144720.jpeg
I need to replace Element 1 through a script.
Element 0 - The texture of the object
Element 1 - The texture of the cracks, which lies on the texture of the object.

Tried:
objectRenderer.materials[1] = newMaterial;
Does not work.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question