Collada Import and shared materails

I’m importing a whole bunch of models that are collada. A lot of them share textures. I set the importer to look in the entire project to find materials. Nonetheless at run time it seems like all models are using instances of the materails rather then the materials themselves and that this is preventing batching.

How can I get Unity to share materials across these imported models??

I’m not. They are existing data I am ripping and recoding. Im doing the collada trans-coding myself with a program I wrote.

I can modify the collada pretty freely if that would help.

I ended up having to force the textures to be shared at runtime. As i instance each object I submit it to this class which forces like named materials to be shared. Now dynamic batching works.

using UnityEngine;
using System.Collections.Generic;

public static class MaterialsCache  {
	static private Dictionary<string,Material> matDict = new Dictionary<string, Material>();
	public static void UsedSharedMaterials(GameObject obj){
		Renderer[] renderers = obj.GetComponentsInChildren<Renderer>();
		foreach(Renderer rend in renderers){
			Material mat = rend.material;
			if (matDict.ContainsKey(mat.name)){
				mat = matDict[mat.name];	
			} else {
				matDict[mat.name] = mat;	
			}
			rend.material=mat;
		}
	}
	
}