CreatePrefabFromSelected

Author: Matthew Miner (matthew@matthewminer.com)

Description
Creates a prefab containing the contents of the currently selected game object.

Usage
Place the script inside the Editor folder. Select a GameObject and choose 'GameObject > Create Prefab From Selection'. A new prefab will be created in the root directory bearing the same name as the GameObject.

Faults:

To Do

 * Currently the script replaces any existing prefab with the same name; more desirable would be to append a number to the filename of the new prefab
 * The selected GameObject should become an instance of the newly created prefab

C# - Updated CreatePrefabFromSelected.cs
I decided to update this script in can anybody is intewrested. It now will give a popup if the prefab already exits and you can choose to overwrite the prefab or cancel. It also replaces the selected gameObject with the new prefab.

- Updated to accept multiple selected objects and not use /prefabs folder (without it it deletes the GO without creating prefab)
 * Cameron Bonde

- Fixed the script to make sure the new object have the same parent as the old one in the scene. --Blikstad 06:11, 20 May 2012 (PDT)

- Extended with choice of save folder by winxalex

C# - CreatePrefabFromSelected.cs Procedural Mesh Version
Small update for procedural mesh creations: it saves the created mesh to disk and inside a prefab, instead of losing it, and keeps all prefab size, shader, collider, and script settings in 1 prefab.

Requires that you have a folder called Assets/savedMesh