Surface Shader with Material Matrix

Has anyone successfully passed a matrix to a surface shader. I’ve found several examples online passing matrices to shaders, but I can’t get my matrix to have any value other than identity. The only difference I can see is that the examples I’ve seen are fragment shaders, and mine is a surface shader.

My script has

   var m = Matrix4x4.TRS(new Vector3(0, 10, 0), Quaternion.identity, Vector3.one);
   targetMaterial.SetMatrix("_BoneMatrix0", m);

and my shader has

 uniform float4x4 _BoneMatrix0;

Seems straightforward enough, so I’m wondering if this feature works at all with surface shaders

set matrix works fine. see code below that just tested. this code rotates texture using matrix.

in your code i saw you apply matrix with offset 10 only. you should not see the difference because offset texture for a natural number will not make any visual affect.

shader code:

Shader "Unity Answers/Diffuse with material matrix"
{
	Properties
	{
		_MainTex ("Base (RGB)", 2D) = "white" {}
	}
	SubShader
	{
		Tags { "RenderType"="Opaque" }
		LOD 200

		CGPROGRAM
		#pragma surface surf Lambert
	
		sampler2D _MainTex;
		float4x4 _Matrix0;

		struct Input
		{
			float2 uv_MainTex;
		};

		void surf (Input IN, inout SurfaceOutput o)
		{
			fixed4 c = tex2D(_MainTex, mul(_Matrix0, float4(IN.uv_MainTex, 0, 0)).xy);
			o.Albedo = c.rgb;
			o.Alpha = c.a;
		}
		ENDCG
	}
	Fallback "VertexLit"
}

script code:

using UnityEngine;
using System.Collections;
public class Matrix2Material : MonoBehaviour
{
    public Material Material2SetMatrix;
    void Update()
    {
        Matrix4x4 m = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0f, 0f, Time.time * 10f), Vector3.one);
        Material2SetMatrix.SetMatrix("_Matrix0", m);
    }
}