// useless private void CheckForMerge() { GameObject[] groups = GameObject.FindGameObjectsWithTag("group"); foreach (GameObject groupObj in groups) { Groupe group = groupObj.GetComponent <Groupe>(); // if 2 groups are to close if ((group.transform.position - transform.position).magnitude < minMergeDistance) { this.MergeGroup(group.GetComponent <Groupe>()); } } }