public static void EditPivot() { if (Selection.activeTransform == null) { Debug.LogError("Select object"); return; } bool ok = MeshCombinerIntegration.RaiseBeginEditPivot(Selection.activeTransform.gameObject, null); if (!ok) { return; } GameObject selectedObj = Selection.activeTransform.gameObject; GameObject pivotObj = InstantiatePrefab("Pivot.prefab"); Pivot pivot = pivotObj.GetComponent <Pivot>(); pivot.Target = selectedObj.transform; pivot.transform.position = selectedObj.transform.position; pivotObj.transform.SetParent(selectedObj.transform.parent, true); pivotObj.transform.SetSiblingIndex(selectedObj.transform.GetSiblingIndex()); Undo.RegisterCreatedObjectUndo(pivotObj, "Battlehub.MeshTools.EditPivot"); Selection.activeObject = pivotObj; }
private static void Combine() { GameObject[] selection = Selection.GetFiltered(typeof(GameObject), SelectionMode.Unfiltered | SelectionMode.ExcludePrefab).OfType <GameObject>().ToArray(); GameObject activeSelected = Selection.activeTransform == null?selection.FirstOrDefault() : Selection.activeTransform.gameObject; CombineResult result = MeshUtils.Combine(selection, activeSelected); if (result != null) { MeshCombinerIntegration.RaiseCombined(result.GameObject, result.Mesh); } }