Transparent rendering mode doesn't work in windows build

Unity: 5.0.2f1

Lang: C#

I’m trying to set a GameObject to transparent rendering mode, ingame. It works perfectly in the editor mode, but does nothing in the windows build.

This is what i’m doing:

// make object semitransparent
Material m = transform.parent.GetComponent<Renderer>().material;
		Color color = m.color;
		color.a = 0.5f;

		m.SetFloat("_Mode", 3f);
		m.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
		m.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
		m.EnableKeyword("_ALPHABLEND_ON");
		m.renderQueue = 3000;
		m.SetColor("_Color", color);

¿Why doesn’t work in Windows Build?

Hi,
If there are no other materials present in a scene in your project then unity will not include that transparent render mode when compiling.
You need to have a material that uses fade in a scene somewhere or in the Resources folder for it to be compiled.
I believe that this could be your problem.

Hope this can help