How can you destroy an Instantiated object by code without affecting its Parent?

void Start () {
playerHealth = 20;
}

void OnTriggerEnter (Collider Other) {
if (Other.tag == (“eyelasertag”)) {
Destroy (Other.gameObject);
playerHealth = playerHealth - 1;

}

}
}

Basically the idea is I have a character shooting different weapons, one of which circles around him. He fights multiple enemies til he dies. The problem is, the one that circles around him takes away damage from the main player, whom it’s Parented to. None of the other attacks do this. It only happens with one specific kind of attack, by only one enemy, though they basically use nearly the same code.

The above coding is set on the player, not the player’s attack, and yet when the circling move hits the first kind of enemy’s attack, the player takes damage and the enemy attack is also destroyed. This is not what I want. When I remove that code, nothing happens… the attack goes right through the blasts, but the player also cannot take damage from the hits.

all of the enemies’ attacks share the same Tag.

I’ve been trying to get this right by myself now for several hours, and I finally gave up. Please help

The code I used to instantiate it is this. The script is set on the enemy that shoots the attack:

void Update () {

if (Time.time > nextFire) {
nextFire = Time.time + fireRate;

GameObject sob = (GameObject)Instantiate (eyelaser, laserspawn.transform.position, laserspawn.transform.rotation);
sob.tag = “eyelasertag”;
}

}

and here’s the main code for the player’s attack:

void Start () {
Circle.transform.parent = CircleSpawn.transform;

}
// Update is called once per frame
void Update () {

if (Input.GetButton(“Fire2”) && Time.time > nextFire)
{
nextFire = Time.time + fireRate;
nextFire = Time.time + fireRate;
GameObject circleClone = (GameObject) Instantiate(Circle, CircleSpawn.position, CircleSpawn.rotation);

circleClone.transform.parent = CircleSpawn.transform;
Destroy (circleClone,10);

}

}

Please check the forum guides for posting source code. Bracketing it properly will make it format for ease of reading.

Generally if you destroy a game object, absent another piece of code detecting this and doing something more, it destroys the object and all children, but it does NOT go upwards to the parents.