Breaking a prefab connection

Is there a way to break a prefab connection through the editor? If I delete the prefab, the instance of it turns red and seems to want the underlying prefab restored. As it is, the only option seems to be to first delete one of the instance's components (or add one), which causes the editor to warn you that you're losing the connection. Then it's safe to delete the prefab.

Is there a more straightforward way to do this?

Are you looking for “GameObject>Break Prefab Instance” in the menu?

You can use the PrefabUtility.DisconnectPrefabInstance function to do that:

http://unity3d.com/support/documentation/ScriptReference/PrefabUtility.DisconnectPrefabInstance.html

EDIT This answer is obsolete as of Unity 3.5, see accepted answer.

It's not a direct command, but if you modify the object derived from the prefab, you will be asked if you want to break the connection. You could make a small, reversible change, agree to break the prefab connection and then reverse the change. Then, if you delete the prefab, the object is no longer strictly an instance.

This works - I’ve tried it. However be warned that it will active gameObjects and their children. So what I did was store the list of active values for the whole hierarchy and then reapply the active values on the clone

string name = prefabedGO.name;
Transform parent = prefabedGO.transform.parent;
prefabedGO.transform.parent = null; // unparent the GO so that world transforms are preserved
GameObject unprefabedGO = (GameObject)Object.Instantiate(prefabedGO); // clears prefab link
unprefabedGO.name = prefabedGO.name;
unprefabedGO.active = prefabedGO.active;
DestroyImmediate(prefabedGO); // or this could just hide the old one .active = false;
unprefabedGO.transform.parent = parent;

Hrmmm.
This is still a troublesome thing.
Here’s my ping to the question and a hopefully a clarification of the pain this brings.
And perhaps a start on how to fix it.
Imagine this…
I made some an awesome prefab (pappy) that has lots of handy and complicated children (kiddos).
I then copy a kiddo and paste it as a child to my new collection (newHotness).
Now I am secretly screwed (trouble to silently appear later).

So I have:

pappy   (a prefab)
  kiddo1
  kiddo2
  koddo3

and

newHotness
  kiddo2
  newKid

I create a prefab out of newHotness (cause I’m like that).

Later I’m working on newHotness and I notice that I need to Apply my edits to the newHotness prefab. Sadly, I had kiddo2 selected and it applies my edits to kiddo2 back to the pappy prefab!

Whaaaaaat?!@#?!@?

I finally figure out that the prefab connection (like a sort of plague-like infection) has come along for the ride. kiddo2 never forgets who pappy was. Let’s call it the “eternal inappropriate connection.” What I desire more than root beer itself is a script that will let me remove the “eternal inappropriate connection” so that kiddo2 can go live his own new life as a member of the newHotness prefab. Anyone know some magic? Ultimately we need a new button next to Select, Revet, Apply, called “Unlink.” For now, we make a specialized script:

[MenuItem("GameObject/Unlink Prefab")]
static void UnlinkPrefab() 
{
	foreach( GameObject g in Selection.gameObjects )
	{
		UmmmmmmLikeBreakThatPrefabLinkSomehow( g );
	}
}

Anybody have a guess for what UmmmmmmLikeBreakThatPrefabLinkSomehow() should be?
-Ken =]

Make a little script to create a shortcut to the “Break Prefab Instance” button.
Put this script in a folder named “Editor”.
Just hit Alt + p to break prefabs from now on.

using UnityEngine;
using UnityEditor;

public class BreakPrefab : MonoBehaviour {
	
	[MenuItem("Editor Helpers/Break Prefab &p")]
	static void Break(){
		
		Undo.RegisterSceneUndo("Break Prefab");
		EditorApplication.ExecuteMenuItem("GameObject/Break Prefab Instance");
	}
}

Select the object in your hierarchy. Then go to GameObject>Break Prefab Instance. I just spent 20 minutes learning how to write an editor script to do this, only to see the option in the menu when I finished the script.