PrefabUtility.ReplacePrefab in runtime have bug?

when i changed the gameobject’s materail in runtime ,then use PrefabUtility.ReplacePrefab to save prefab ,But when stop play the game,the materail back to old…why?any fix?

public static void  ReplacePrefab(GameObject currentObj)
	{
		string path;
		UnityEngine.Object parentObject = EditorUtility.GetPrefabParent(currentObj);
		path = AssetDatabase.GetAssetPath(parentObject);
	
		Debug.LogWarning("--------have---path:"+path);
		if(path.Length==0)
		{
			path=prefabeLocalPath+currentObj.name+".prefab";
		}
		GameObject  goo=(GameObject)AssetDatabase.LoadAssetAtPath(path,typeof(GameObject));
		if(goo !=null)
		{
			  if (EditorUtility.DisplayDialog("Are you sure?", 
                    path+"already exists. Do you want to overwrite it?", 
                    "Yes", 
                    "No"))
			{
//				EditorUtility.ReplacePrefab(currentObj,goo,ReplacePrefabOptions.ReplaceNameBased|ReplacePrefabOptions.ConnectToPrefab);
//				AssetDatabase.Refresh();
				PrefabUtility.ReplacePrefab(currentObj, PrefabUtility.GetPrefabParent(currentObj), ReplacePrefabOptions.ConnectToPrefab|ReplacePrefabOptions.ReplaceNameBased);
			}
		}else
		{![1420052--74695--$1.png|1088x571](upload://d2uC9JPfuLkBFf0beVmrkyL7re9.png)![1420052--74696--$2.png|1028x463](upload://crz9RiPOB7qlsHDhhRCI9lY2onz.png)![1420052--74697--$3.png|1227x252](upload://i7inrqYDH5PnsPOTYgr6LuB0oQS.png)![1420052--74698--$4.png|1024x449](upload://3MBFRBeIDQ3oR9dpSii7eV2UiA2.png)![1420052--74699--$5.png|1059x380](upload://ksWO6z58XXOABhs2wIUCcI0bgS4.png)
			if (EditorUtility.DisplayDialog("Are you sure?", 
                    "creat :"+prefabeLocalPath+currentObj.name+".prefab", 
                    "Yes", 
                    "No"))CreateNew(currentObj,prefabeLocalPath);
		}
		
	}

No body meet this bug?

PrefabUtility is only for Editor usage, it’s not meant to be used at runtime.

@dreamerflyer: Is it possible that the assigned material is a runtime material instance and not the actual material? In that case the outcome would be correct.

OK ,thanks Dantus,I Will check it!