private static void SetPivot(MenuCommand command, PivotPosition pivot) { var gameObject = command.context as GameObject; if (gameObject == null) { return; } Undo.RegisterFullObjectHierarchyUndo(gameObject, "Set Pivot"); var childMeshFilters = gameObject.GetComponentsInChildren <MeshFilter> (); var offset = HierarchyUtility.GetPivotOffset(childMeshFilters, pivot); HierarchyUtility.OffsetChildren(gameObject.transform, offset); }