hit.gameObject.tag

ok im using hit tags and the first one works but the second one just freezes so if i tag the sheep as "Bunny" they burst in to a red paritcal cloud but the sheep dont un less I use the Bunny tag but ....well I need more blood for the sheep! so I want to run a bigger partial explosion.

var particle : GameObject; 
var particleSheep : GameObject; 

function OnControllerColliderHit( hit: ControllerColliderHit) { 
    Debug.Log("hit Call");
    if(hit.gameObject.tag == "Bunny")  { 
        Debug.Log("Bunny hit");
        // create the instance of the prefab
        var clonedParticle : GameObject = Instantiate(particle,
                                                      transform.position, 
                                                      transform.rotation); 

        clonedParticle.particleEmitter.emit = true; // tell it to emit

        Destroy(clonedParticle, 4); //destroy the particle in 4 seconds
        Destroy(hit.gameObject); 
    }
    else if(hit.gameObject.tag == "Sheep") { 
        Debug.Log("Sheep hit");
        // create the instance of the prefab
        var clonedParticleSheep : GameObject = Instantiate(particleSheep, 
                                                           transform.position, 
                                                           transform.rotation);

        clonedParticleSheep.particleEmitter.emit = true; // tell it to emit

        Destroy(clonedParticleSheep, 4);//destroy the particle in 4 seconds
        Destroy(hit.gameObject); 
    }
}

Since you say it works when you tag the sheep "Bunny", the colliders must be set up properly. The only thing I can see that could be wrong would be that you have not tagged your sheep, "Sheep" (with a capital S) since that is what you compare the tag to.

If that doesn't solve the problem, then try adding an "else" after your sheep's "if", such as this

else 
    Debug.Log(hit.gameObject.tag);

And check your console, to see if it gets printed (and what it prints)

There are only 2 reasons that I see that would cause your Debug("Sheep Hit") not to happen:

  1. The sheep are not properly tagged Sheep
  2. The sheep are not generating an OnControllerColliderHit

To address number 1. please verify that all instances of your sheep are properly tagged exactly Sheep with the exact case and spelling as you are checking for in your if statement.

To address number 2. please verify that your sheep have colliders that are setup properly. It seems that since you are colliding with your bunnies that your character controller capsule and movement must be setup correctly, but all the same, please ensure that neither of these is preventing collisions somehow. Also, please make sure that your sheep are on an appropriate layer for which Physics interaction with the layer the CharacterController is on has not been disabled.

If your Debug is printing, please rephrase the question to describe what exactly is not happening.