public void StopMovingObject(ModelingObject movedObject) { foreach (Transform unit in this.transform) { if (unit.CompareTag("ModelingObject")) { ModelingObject currentModelingObject = unit.GetComponent <ModelingObject> (); if (currentModelingObject != movedObject) { currentModelingObject.StopUseAsPossibleSnap(); } } if (unit.CompareTag("Group")) { if (unit.transform != movedObject.group) { foreach (Transform groupElement in unit.transform) { if (groupElement.CompareTag("ModelingObject")) { ModelingObject currentModelingObject = groupElement.GetComponent <ModelingObject> (); if (currentModelingObject != movedObject) { currentModelingObject.StopUseAsPossibleSnap(); } } } } } } }