Breaking a prefab doesn't break it completely?


When i instantiate an object in a scene and break the prefab at GameObject → Break Prefab Instance, then its not more blue in the hiearchy list, however, in the Inspector, i can still see that i can apply to the prefab.

So my question is, how do i break the prefab from my instance competely?

As far as i know there’s no way in the editor besides using Instantiate from an editor script to clone the object. I haven’t tried it recently, so that might has been changed as well but used to work pretty well. When they introduced the “Break Prefab connection” button it fully disconnects the instance. I guess that most people complained that it’s not possible to reconnect it. They renamed the button to “Break Prefab Instance” and now it’s possible to reconnect to the prefab. So this is a quite recent change and i guess it’s on purpose :wink:

You can try PrefabUtility.DisconnectPrefabInstance in an editor script, but i guess that does the same as the menubutton. Instantiate used to do the job (actually it was a problem until we get PrefabUtility.InstantiatePrefab which lets you instantiate a prefab in the editor and preserve the prefab connection).

There seems to be no direct solution, which is why I created a small script that I attach to prefabs that I don’t want to be changed from the hierarchy:
It first breaks the prefab connection, then creates a temporary prefab in the Assets folder and connects the current object to that prefab. On Disabling, the prefab gets removed again. Seems very hacky, but works in my case.

Here is the code:

using System.IO;
using UnityEngine;
using UnityEditor;

/// <summary>
/// This script can be attached to any prefab and prevents the prefab from being edited 
/// and saved in the inspector view.
/// This can be desired when changes to instances should not affect the prefab of the object.
/// </summary>
public class DisconnectPrefabOnSpawn : MonoBehaviour
    private Object tmpObject;

    private void OnEnable()
        if (!File.Exists(Application.dataPath + "/TMPPrefab.prefab"))
            tmpObject = PrefabUtility.CreatePrefab("Assets/TMPPrefab.prefab", gameObject, ReplacePrefabOptions.ConnectToPrefab);



    private void OnDisable()

public static void RemoveDisconnectedReferences(string scenePath)
var lines = File.ReadAllLines(scenePath);
var sb = new StringBuilder();
var inPrefab = false;
var removingDisconnectedPrefab = false;

	for (int i = 0; i < lines.Length; i++)
		var line = lines*;*
  •  if (line.StartsWith("---"))*
  •  	inPrefab = lines[i + 1] == "Prefab:";*
  •  if (inPrefab)*
  •  	sb.Append(line + "


  •  else*
  •  {*
  •  	if (line.StartsWith("  m_PrefabParentObject:"))*
  •  	{*
  •  		sb.Append("  m_PrefabParentObject: {fileID: 0}


  •  		removingDisconnectedPrefab = true;*
  •  	}*
  •  	else*
  •  	{*
  •  		if (!(removingDisconnectedPrefab && line.StartsWith("    type:")))*
  •  			sb.Append(line + "


  •  		removingDisconnectedPrefab = false;*
  •  	}*
  •  }*
  • }*

  • File.WriteAllText(scenePath, sb.ToString());*

Prefab breaking Editor script solution also here, confirmed working at Dec 20, 2017 :

Breaking a prefab requires you to select the game object in the scene and then going to the game object menu > break prefab connection. Then you can now safely delete the prefab asset in your project folder without your scene game object turning red.

If you do not want to delete the asset from your project folder then I think the revert option may likely remain in view. However I have not tried to rename my project folder asset after the breaking has occurred…their may still be a way.