Find a specific object even though there are many of them.

In my scene there are a lot of cactus prefabs, with a explosion particle as children.
They all have the same name.
I have a script attached to each cactus saying if i hit it, then a explosion will happen.
This is my script:

#pragma strict

var emission = 100;

function Start () {
    //Emission starts at 0, and when you hit the cactus it gets to 100.
    gameObject.particleSystem.emissionRate = 0;
}

function Update () {

    if(GameObject.Find("Cactus3").GetComponent(Explode).explosion == true) {
    //if i hit the cactus this will happen
   print("HI");
    gameObject.particleSystem.emissionRate = emission;
    }
}

Since all of the cactuses are names cactus3 then all the explosion in the scene will detonate at same time even though i only hit one.

Can i say someting like if(GameObject.FindParent(“Cactus3”).GetComponent(Explode).explosion == true) {

for example if i have a child of a parent. This child has a script attached. In this script it says something like: if parent.explosion = true, then something.

I dont know how to explain this probably so if you have questions please ask.

You can access your direct parent via transform.parent. So if the explosion prefab is a direct child of the cactus, just do

if (transform.parent.GetComponent(Explode).explosion)
    particleSystem.emissionRate = emission;

Like GetComponentInChildren Unity now provides a method called GetComponentInParent. This will search up the hierarchy for that specific component. In your case I would suggest:

var emission = 100;
var explode : Explode;

function Start ()
{
    //Emission starts at 0, and when you hit the cactus it gets to 100.
    gameObject.particleSystem.emissionRate = 0;
    explode = GetComponentInParent(Explode);
}

function Update ()
{
    if(explode.explosion)
    {
        print("HI");
        gameObject.particleSystem.emissionRate = emission;
    }
}

However, if your cactus is a prefab, you simply should assign the “Explode” script to tha variable in the inspector. When instantiating a prefab such internal references will point to the internal object.