void CheckForConnection() { bool found = false; List <GameObject> conns = world.Clothes; foreach (GameObject go in conns) { Transform t = go.transform; Connectable conn = t.parent.parent.GetComponent <Connectable> (); if (conn.type == this.type && (this.transform.position - t.position).magnitude < grabDistance) { world.CleanConnections(); connected = true; mouseJoint.enabled = false; conn.AddClothes(this); break; } } }