i put some objects in my level, pickables, and a counter script write how much object i have picked up. I learned that in the “learn me silly” tutorials. Everytimes i pick an object, my counter can tell me that i pick only one, and also sometimes 2 (if i try 2 times my level, for the same object, he tell me the first time that i pick 1, and the next time he can tell me 2.) Well i have 8 objects to pick up, and if my counter say me that i picked up 12 objects when i picked only 8…
here is the script i used:
static var Count : int = 0;
var CollectSound : AudioClip;
function OnControllerColliderHit(hit:ControllerColliderHit){
if(hit.gameObject.tag == “Cristal”){
audio.PlayOneShot(CollectSound);
Destroy(hit.gameObject);
Count++;
}
}
The collider hit is a cube, if it can help 
It looks as though the colliders may be making intermittent contact several times before the object is destroyed. Perhaps you could change the object’s tag just before calling Destroy. That way, even if OnControllerColliderHit repeats, the “if” statement should stop the count being incremented more than once.
thank you for this precision
But i’m newbie in javascript
could you show me how this line will see in script?
well i find a solution that work
So i give te code for all who can have the same problem:
static var Count : int = 0;
var CollectSound : AudioClip;
function OnControllerColliderHit(hit:ControllerColliderHit){
if(hit.gameObject.tag == “Cristal”){
audio.PlayOneShot(CollectSound);
DestroyImmediate(hit.gameObject);
yield;
Count++;
}
}
Wala!!! If i understand good, the command “destroy” can take some time to destroy the object, so if it take time, i can colide with object another time before it is destroyed. But with the command “destroyImmediately” the object get destroy exactly on the moment that the first collision happend… without any possibility of wrong apparently 