Changing a texture runtime with PaintContext API

I’m currently building a village that i need to paint roads on the terrain texture in runtime. Currently i have two layers “grass” and “gravel road”. I need to be able to apply the gravel road texture to the grass in runtime.

What would be the best way to do it? It looks like its using PaintContext API.

Does anyone have an example of doing this? Its a bit over my head.

Thanks for helping!

I support the question. PaintContext, TerrainPaintUtility, etc - it all remains a mystery how to work with it. It is very difficult to understand how this should be applied. In fact, until there is a normal explanation, this API is useless for the community.

Paintcontext documentation is incomprehensible. Can someone please post a tutorial on how to use it?