- Home /
Question by
ed-spatialsauce · May 12, 2020 at 04:56 AM ·
shadershadersshader programming
EnableKeyword("_EMISSION") not working 2019.3.13f1
Hey there,
Does mat.EnableKeyword("_EMISSION") no longer work in 2019.3.13f1?
I can't find out if it was removed or if it's broken. Is there a new way to enable emission or to check if it is enabled?
I made a new project with a cube that has a material using a standard shader. I think added the script below and plugged in the material. It seems the keyword _EMISSION doesn't exist for the shader?
Thanks
using UnityEngine;
public class Emission : MonoBehaviour
{
public Material mat;
public bool emEnabled = false;
private void Awake()
{
mat.DisableKeyword("_EMISSION");
emEnabled = false;
}
private void Update()
{
if (Time.time > 2f && !emEnabled)
{
emEnabled = true;
mat.EnableKeyword("_EMISSION");
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Scene Color Node in Shader Graph not working with Unity's 2D Renderer and URP 5 Answers
How to add Emission to my custom shader? 2 Answers
The Best Way To Make Stylised Grass in Unity? 0 Answers
Making shader not ignore Light on transparent areas ? 0 Answers
Shader for distorting a texture as if it were on a sphere 3 Answers