public static Material GetMaterialForRendering(MaskableGraphic graphic, Material baseMaterial) { if (baseMaterial == null) { return(null); } List <IMaterialModifier> list = TMP_ListPool <IMaterialModifier> .Get(); graphic.GetComponents <IMaterialModifier>(list); Material material = baseMaterial; for (int i = 0; i < list.Count; i++) { material = list[i].GetModifiedMaterial(material); } TMP_ListPool <IMaterialModifier> .Release(list); return(material); }
public static Material GetMaterialForRendering(MaskableGraphic graphic, Material baseMaterial) { if (baseMaterial == null) { return(null); } var modifiers = TMP_ListPool <IMaterialModifier> .Get(); graphic.GetComponents(modifiers); var result = baseMaterial; for (int i = 0; i < modifiers.Count; i++) { result = modifiers[i].GetModifiedMaterial(result); } TMP_ListPool <IMaterialModifier> .Release(modifiers); return(result); }