S
S
Sergey Serega2019-10-18 18:53:38
Unity
Sergey Serega, 2019-10-18 18:53:38

How to change emission color programmatically in unity?

How to programmatically change the emission color of a standard shader in unity? tried like this:


GetComponent().material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.RealtimeEmissive;
GetComponent().material.SetVector("_EmissionColor", new Vector4(0.3f, 0.9f, 1f, 1f));

Interestingly, the parameters are applied, but when you manually expand the shader parameters in the inspector with the mouse during the game. What is the problem?

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