Manually Update Terrain Collider

Hey guys, so I just recently learned about the Unity 5 bug that doesn’t update the collider of the terrain until the project is opened again, and I was wondering if there was a way to manually update/modify the collider. My guess is that the collider is created/updated upon construction of the terrain in editor, something like the OnConstruction() function exposed to every UObject in Unreal4, and also updated anytime the terrain editor tools are used. I looked into the terrain collider documentation, but there doesnt seen to be any variables I can directly modify to update the collider. If I had the source it’d be easy enough to figure out, but unity 5 for free already more than I could hope for. Any one have an idea on how to manually update a collider?

For anybody looking for help, in v 2017, 2018… to update the TerrainCollider you have to update the heights on the terraindata of both the terrainCollider and the terrain. Seems like there is a copy. Changing the terrain only will update the visualization but not the collider itself.

terrainCollider.terrainData.setHeights(...)
terrain.terrainData.setHeights(...)

In v2019 the terrain has been moved to GPU and the API changed, so maybe this doesn’t work. Seems like there is a function to update “dirty” data.