can't get this right... help please...

hi all…

i have come up with this error when im converting C# to JavaScript…

the C# is fine… only in the JavaScript have the problem…

i have 3 errors…

  1. BCE0048 : Type ‘UnityEngine.GameObject’ does not support slicing.

  2. BCE0067 : There is already a local variable with the name ‘i’.

  3. BCE0019 : ‘Length’ is not a member of ‘UnityEngine.GameObject’.

here’s the script…

DirectionX = 0;
	for(var i : int = 0; i < _collider.Length; i++){
		_collider*.GetComponent(BoxCollider).isTrigger = true;*
  •   }*
    
  •   yield WaitForSeconds(WaitTime);*
    
  •   	for(var i : int = 0; i < _collider.Length; i++){*
    

collider*.GetComponent(BoxCollider).isTrigger = false;
_
}*

* Wait = false;*
}
thanks for your help… totally appreciate it…
^_____^

Errors 1 and 3: You have a problem in the _collider array declaration (not included in the code above) - it probably should be:

  var _collider: GameObject[];

Error 2: In JS, variables defined in loop statements or inside brackets aren’t local to them (different from C#). Remove the var keyword from the second for - the variable i declared in the first for exists in the whole function.