Search Unity

is it possible to change emission value in code

Discussion in 'Shaders' started by melonhead, Jan 22, 2017.

  1. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    630
    can the emission value brightness be changed in code, i have looked around but nothing seems to work properly, and if it can be done is it possible to do this on a clone of a prefab without changing it on other clones of the same prefab

    thanks in advance as i am having great headache with this
     
  2. abitofjohn

    abitofjohn

    Joined:
    Nov 6, 2012
    Posts:
    27
    [MaterialName].SetColor("_EmissionColor", (colour*brightness float));

    e.g


    MyMaterial.SetColor("_EmissionColor", Color.blue*1.5f);

    Hope that helps