public static Material Clone(this Material originalMaterial, TexturesSet newTextures) { var material = UnityEngine.Object.Instantiate(originalMaterial); if (newTextures.MainTex != null) { material.ModifyTexture("_MainTex", newTextures.MainTex); } if (newTextures.XYSMap != null) { material.ModifyTexture("_XYSMap", newTextures.XYSMap); } if (newTextures.APRMap != null) { material.ModifyTexture("_APRMap", newTextures.APRMap); } return(material); }
public static Material Clone(this Material originalMaterial, TexturesSet newTextures) { var material = UnityEngine.Object.Instantiate(originalMaterial); if (newTextures.MainTex != null) { material.ModifyTexture("_MainTex", newTextures.MainTex); } if (newTextures.XYSMap != null) { material.ModifyTexture("_XYSMap", newTextures.XYSMap); } if (newTextures.APRMap != null) { material.ModifyTexture("_APRMap", newTextures.APRMap); } return material; }