- Home /
Question by
potter3366 · May 09, 2016 at 10:40 PM ·
unity 5shaderemission
Change emission brigthness in standard shader with script
I can change emission brigthness in play mode, but not in windows standalone player:
using UnityEngine;
using System.Collections;
public class Load : MonoBehaviour
{
private int brojac;
private GameObject clone;
private bool kontrola;
private Material mat;
private Renderer rend;
public GameObject[] tileObjects;
void Start ()
{
brojac = 0;
kontrola = true;
}
void Update ()
{
if (Input.GetMouseButtonDown (0) && kontrola) {
load_model ();
}
if (clone != null && !kontrola) {
if (Input.GetMouseButtonDown (1)) {
Destroy ();
}
if (Input.GetKey ("k")) {
rend.material.SetColor ("_EmissionColor", Color.red * 1.5f);
//DynamicGI.SetEmissive (rend, Color.red);
DynamicGI.UpdateMaterials (rend);
}
if (Input.GetKey ("l")) {
rend.material.SetColor ("_EmissionColor", Color.black);
//DynamicGI.SetEmissive (rend, Color.black);
DynamicGI.UpdateMaterials (rend);
}
}
}
void load_model ()
{
clone = Instantiate (tileObjects [brojac], new Vector3 (0, 0, 0), Quaternion.identity) as GameObject;
clone.name = "Lamp";
rend = clone.GetComponent<Renderer> ();
rend.material.EnableKeyword ("_EMISSION");
kontrola = false;
}
void Destroy ()
{
Destroy (clone, 0.5f);
brojac++;
if (brojac == 15)
brojac = 0;
kontrola = true;
}
}
Comment
Best Answer
Answer by potter3366 · May 10, 2016 at 08:44 AM
SOLUTION
Edit - Project Settings - Graphics - Include Standard Shaders
Your answer
![](https://koobas.hobune.stream/wayback/20220612080456im_/https://answers.unity.com/themes/thub/images/avi.jpg)