public void CollisionDetected(ChildColliderController childScript) { if (childScript.gameObject.tag == "CUBE_" + CollisionSide.ToString() && canBeDestroyed) { Destroy(this.gameObject); } else { canBeDestroyed = false; } }
// GameObject activeSide; // GameObject[] children = new GameObject[5]; // Use this for initialization void Start() { //We iterate through the children and setup the child objects components propertys foreach (Transform child in projectile.transform) { // getChildren(child.gameObject); ChildColliderController childComponent = child.GetComponent <ChildColliderController>(); childComponent.SetParentObject(projectile); if (child.gameObject.tag == "CUBE_" + CollisionSide.ToString()) { childComponent.SetActive(); } } }