utility create new prefab and createprefab from hierarchy doesn't seem to work in unity 5.6

Hello could somebody help please?

I want to create a prefab in c# code from a script like I use to be able to do, but doesn’t seem to work the way the manual says it does.

 UnityEditor.PrefabUtility.CreatePrefab(Application.dataPath + "/SavedPrefabs/" + prefabName + ".prefab", gameObject);

This does not work, nor does:

   UnityEditor.PrefabUtility.CreateEmptyPrefab(Application.dataPath + "/SavedPrefabs/" + gameObject.name + ".prefab");

It only gives me an error cannot create prefab. Path is correct, name and extension is correct. Does it not work anymore since Unity 4.0? Please could someone solve this boggle? I’ve search google and unity answers and manual, and cannot find a solution as to why it doesn’t work. Please help?

Actually its the path change it from :

Application.dataPath + "/SavedPrefabs/" + prefabName + ".prefab"


"Assets/" + "SavedPrefabs/" + prefabName + ".prefab"