I am attempting to set Material Type from “Standard” to “Subsurface Scattering” via an Editor script in an existing material, but I am having no luck.
This is what I want to set:
Code I’ve tried:
material.SetFloat("_MaterialID", 1.0f);
material.SetFloat("_TransmissionEnable", 1.0f);
var diffusionProfile = AssetDatabase.LoadAssetAtPath<DiffusionProfileSettings>("Assets/Settings/HDRPDefaultResources/SkinDiffusionProfile.asset");
HDMaterial.SetDiffusionProfile(material, diffusionProfile);
material.EnableKeyword("_MATERIAL_FEATURE_SUBSURFACE_SCATTERING");
material.EnableKeyword("_MATERIAL_FEATURE_TRANSMISSION");
HDMaterial.ValidateMaterial(material);
Debug.Log("Subsurface is: "+material.IsKeywordEnabled("_MATERIAL_FEATURE_SUBSURFACE_SCATTERING"));
Debug.Log is false! (and the material is still “Standard” material type in Inspector)
Thanks for any help!