1
\$\begingroup\$

enter image description here

Hi, I just wanted to know if there is a way to set emission's texture via script. I haven't found nothing in the documentation, neither on any forum, except the setting of the emission color setting via script.

Thanks in advance.

\$\endgroup\$
3
\$\begingroup\$

If you take a look at the Standard shader, you will see the name of the property you want :

_EmissionColor("Color", Color) = (0,0,0)
_EmissionMap("Emission", 2D) = "white" {}

Then, using the documentation you will see how to assign a named texture to a given material.

GetComponent<MeshRenderer>().material.SetTexture("_EmissionMap", yourTexture ) ;

Here is a link to download the shaders provided by Unity.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks, it worked. I also explored the other Standard Shader Properties you mentioned. \$\endgroup\$ Jan 17 '17 at 3:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .