Hi everyone, I am attempting to set the float on the emissive property on my brake lights material but am not having any luck.
Here is my code:
using UnityEngine;
using System.Collections;
public class BrakeLights : MonoBehaviour {
private Renderer Brakes;
// Use this for initialization
void Start () {
Brakes = GetComponent<Renderer>();
Brakes.material.shader = Shader.Find("Standard");
Brakes.material.EnableKeyword("_EMISSION");
}
// Update is called once per frame
void Update(){
//Brake lights
if(Input.GetKey(KeyCode.Space)){
Brakes.material.SetFloat("_Emission", 1.0f);
//Debug.Log (Brakes.material.shader);
}else{
Brakes.material.SetFloat("_Emission", 0f);
//Debug.Log ("Brakes OFF");
}
}
}
What am I missing here? I am also getting no errors in the console and my debug logs are showing up at runtime when I press spacebar.
Thanks for the help!