Change emission brigthness in standard shader with script - standalone player

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;
     }

  }

SOLUTION

Edit - Project Settings - Graphics - Include Standard Shaders

1 Like

Where do you see this option? Is this something new? I am using Unity 5.2.3. There is no option for this, but I can set the emission color anyways for the player.
2629646--184832--graphics.jpg

j

All my 15 objects are prefabs.
Please post your solution…

I have a material in the Resources folder using the standard shader. So then I think, for my situation, the Standard shader will be automatically be included because it is used for something in the Resources folder. That might explain why I don’t need to add it the list.