Can't get shadows on surface shader with custom light model

Hello, I have made a surface shader with a custom light model but I don’t know how to add shadows to the effect. All the examples from the documentation get shadows because they use the built-in Lambert light model, but the documentation says nothing about getting shadows on custom light models.

Here is my surface shader. Thanks in advance.

Shader "surfaceShader" {

	Properties {
      BaseTexture ("BaseTexture", 2D) = "white" {}
	  NormalTexture ("NormalTexture", 2D) = "bump" {}
	  OcclusionTexture ("OcclusionTexture", 2D) = "white" {}
	  AmbientTexture ("AmbientTexture", CUBE) = "white" {}
	  ReflectionTexture ("ReflectionTexture", CUBE) = "white" {}
    }

	SubShader {
		Tags { "RenderType" = "Opaque" }
	
		CGPROGRAM
		#pragma surface surface CustomModel
		#pragma target 3.0
		
		sampler2D		BaseTexture;
		sampler2D		NormalTexture;
		sampler2D		OcclusionTexture;
		samplerCUBE	AmbientTexture;
		samplerCUBE	ReflectionTexture;

		half4 LightingCustomModel(SurfaceOutput s, half3 lightDir, half3 viewDir, half atten) {

			//Normalize view and light vectors.
			viewDir= normalize(viewDir);
			lightDir= normalize(lightDir);

			//Diffuse.
			half diffuse = max(dot (s.Normal, lightDir), 0.0);
			half3 finalDiffuse= s.Albedo * _LightColor0.rgb * diffuse* atten;
			
			//Specular.
			half3 reflectionVector= reflect(-viewDir, s.Normal);
			half specular= pow(max(dot(reflectionVector, lightDir), 0.0), 64.0);
			half3 finalSpecular= _LightColor0.rgb*specular*atten*0.3;
			
			//Calculate a fresnel term and multiply it by the occlusion to avoid
			//creating bright edges on occluded areas.
			half fresnel= pow(1.0- dot(s.Normal, viewDir), 3.0)*s.Gloss*s.Specular.x*0.3;
			
			//Reflection.
			half3 reflection= texCUBE (ReflectionTexture, reflectionVector).rgb*s.Gloss*fresnel;
			
			//Ambient multiplied by occlusion.
			half3 ambient= texCUBE(AmbientTexture, s.Normal).rgb;
			half3 finalAmbient= s.Albedo*ambient*s.Specular;

			return half4(finalDiffuse + finalSpecular +  reflection + finalAmbient, 1.0);
		}

		
		struct Input{
			float4 color: COLOR;
			float2 uvBaseTexture;
			float2 uv2OcclusionTexture;
			float3 worldRefl;
		};
		
		

		void surface(Input input, inout SurfaceOutput output){
		
			//The albedo is extracted from the RGB channels of the texture and the glossiness is extracted from alpha.
			half4 base= tex2D(BaseTexture, input.uvBaseTexture);
			output.Albedo= base.rgb;
			output.Gloss= base.a;
			
			//Send the world space normal.
			output.Normal= UnpackNormal(tex2D(NormalTexture, input.uvBaseTexture)).rgb;
			
			//Send the ambient occlusion through the specular component (hack).
			output.Specular= tex2D(OcclusionTexture, input.uv2OcclusionTexture);
		}
		
		

		ENDCG

	}
Fallback "VertexLit"
}

Solved, it was my fault, I’m a beginner. I was creating a forward rendering light model when unity does not provide shadows for that rendering mode.

it does provide shadows but only for the first directional light in the scene.

I’m facing the same problem. Can you tell how you solved your problem? I only want shadows to be received, in forward rendering mode, from the single directional light in my scene on objects using my shader with a custom lighting model.

Add
Fallback “VertexLit”
before the last } of your shader.