Unity 5 invisible shadow caster shader

Hi!

I need a shader that allows a object to be invisible but still cast shadows. I found a few shaders but I can not get them to work in Unity 5. So if anyone knows how it can be made, please tell me!

Thanks in advance

I’m no shader guru, but here’s a workaround. Basically it’s a transparent / alpha shader, using addshadow. Note it needs a fallback that casts a shadow, as per this post by Aras: http://forum.unity3d.com/threads/fallback-off-turns-off-shadows-in-surface-shader.257430/#post-1703672

If anyone wants to improve on this, feel free.

Shader "Invisible/InvisibleShadowCaster" {
	SubShader {
		Tags { 
			"Queue"="Transparent"
			"RenderType"="Transparent" 
		}
		CGPROGRAM
		#pragma surface surf Lambert alpha addshadow

		struct Input {
			float nothing; // Just a dummy because surf expects something
		};

		void surf (Input IN, inout SurfaceOutput o) {
			o.Alpha = 0;
		}
		ENDCG
	} 
	FallBack "Diffuse"
}

Unity 5 MeshRenderer->Cast Shadows can be set to On,Off,2 sided or Shadows Only. Use Shadows Only.