Jump to content

Turn OFF/ON emission of specific material at runtime by script


photo

Recommended Posts

Dear all,
Sorry for this really basic and "noob" question but i'm just trying to move from another engine, and I'm little bit "lost"
So.....I've now my model with their material, and emission turned ON with specific texture, and the result compared to other engine in terms of graphics out of the box is really amazing!
But now I want to access that material by a script, and turn on/off emission at runtime, maybe at "L" key press or something like that.

Any tips or example that I can follow to achieve this result ( I have basic programming knowledge but totally new on UNIGINE )

Thanks ;)

 

Unigine_1.PNG

Unigine_2.PNG

Link to comment

ok add make a reference to the material as component property then add this to your code, to see all available parameters

                for (int i = 0; i < Material.NumParameters; i++)
                {
                    //Log.Message("\n" +Material.GetParameterName(i));
                }
the parameter you are looking for should be "emission_scale"

use it like this                 Material.SetParameterFloat("emission_scale", 0.3f);

 

  • Like 1
Link to comment
×
×
  • Create New...