InsertParent

Author: Neil Carter (NCarter)

Description
This script is an alternative to the built-in Make Parent command. Whereas the Make Parent command makes the first object you select the parent of subsequently selected objects, this script inserts a new GameObject which becomes the parent of all selected objects.

Usage
You must place the script in a folder named Editor in your project's Assets folder for it to work properly.

Select some objects in the Scene view or Hierarchy window, then choose GameObject→Insert Parent from the menu (or press control P). Depending on the nature of the selected objects, it will have one of the following effects:


 * If only one object is selected...
 * ...and it has no parent, a new GameObject will be added, and the selected object will become a child of it.
 * ...and it already has a parent, a new GameObject will be inserted between the object and its original parent.
 * If more than one object is selected, irrespective of whether those objects already have parents, all those objects will become children of the newly created GameObject.

The newly created parent object is named _Parent to make it sort towards the top of the Hierarchy list.