Duplicate terrain

Hello. I’m trying to make a duplicate of my terrain by pressing a key in-game. I’ve tried

using UnityEditor;
AssetDatabase.CopyAsset("Assets/My Assets/NewTerrain.asset", "Assets/My Assets/NewTerrain2.asset");
AssetDatabase.Refresh();

but it doesn’t work… it stops a bit but there is no new asset created. Is the path not declared this way?

Please help!

Edit: solved. srry I just mistyped the name of my terrain :neutral:

When dealing with backslashes “/” your compiler will interpret them as a line break, either double backslash all your backslashes or put a @ in front of your string. Im not sure, but you might have to use AssetDatabase.SaveAssets(); as well