How to instantiate deep copy of a prefab

So I’ve been working on a infinite terrain generation system using chunks of terrain being loaded around the player (think minecraft) and I’ve run into a problem, when I instantiate a prefab or object it does make a full copy of it instead it holds a reference, what this means is that when I copy terrain it shares a height map, If I modify one of the terrain objects then all of them are modified. How can I solve this?

TLDR; instantiating objects holds a reference not a whole new object, causing terrains share height maps and not allowing for individual manipulation of terrain.

Well, in fact this is a little specific to Terrain, but this is true for any Asset related component.

A copy of a Renderer will still point to the same Material for example.

You need to look into TerrainData.

I solved it by assigning a new TerrainData to the Terrain Object:

_terrainData = new terrainData();
terrain.terrainData = _terrainData;