How do I modify the blueprint of the spline track generator to have a dynamic road material?

I’m using spline track generator to create roads. I tried using the roadmesh variable to create a dynamic material, but it says it isn’t compatible with with primitive component references. I’d like the road to be able to change texture based on if it is raining or not.