Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Change emission in WebGL

Discussion in 'Web' started by sumpfkraut, Jan 15, 2022.

  1. sumpfkraut

    sumpfkraut

    Joined:
    Jan 18, 2013
    Posts:
    242
    I change the material emission in a script and it works in editor and standalone. But it has no effect in WebGL.
    Someone know what's wrong with this code?

    Code (CSharp):
    1. Material m;
    2. float intensity = 0.5f;
    3.  
    4. //emission URP
    5. m.EnableKeyword("_EMISSION");
    6. m.SetVector("_EmissionColor", m.GetColor("_BaseColor") * intensity);
    7.  
    8. //no emission URP
    9. m.DisableKeyword("_EMISSION");
    10.  
     
  2. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,549
    Is this WebGL 1 or 2? The only thing that comes to mind is that there's no Post Processing in WebGL 1 - so things like Bloom etc. don't work. If your test relies on Post Processing and it's a WebGL 1 build that would explain it. Otherwise, if it's working everywhere except WebGL 2.. I have no idea.
     
  3. sumpfkraut

    sumpfkraut

    Joined:
    Jan 18, 2013
    Posts:
    242
    It's WebGL 2, and i don't use post processing