Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

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:
    603
    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