For statement stops function?

I am working on a physics building game, and I need to switch to play mode from edit mode. When I switch, I need to disable the sphere colliders on all gameobjects with the tag “probe”, and connect all the parts to the fuselage (tagged “fuse”). Here is the script-

var forces : GameObject[];
var probes : GameObject[];
function Update () {
	forces = GameObject.FindGameObjectsWithTag("force");
	probes = GameObject.FindGameObjectsWithTag("probe");
	if(Input.GetKeyDown("l")) {
		Disablescols ();
		Enablephysics ();

function Enablephysics () {
	for(var i = 0; i <= forces.length; i++){

_ forces*.AddComponent(HingeJoint);_
_ forces.GetComponent(HingeJoint).connectedBody = GameObject.FindGameObjectWithTag(“fuse”).rigidbody;
forces.GetComponent(HingeJoint).spring.damper = Mathf.Infinity;

function Disablescols () {
* for(var k = 0; k <= probes.length; k++){*
* probes[k].GetComponent(SphereCollider).enabled = false;*
* }*
The script is executing everything well, except it does not add the rigidbodies and does not add the joints. In short, it is not executing Enablephysics ();. Is Unity stopping the script after the FOR statement in Disablescols () met? Can someone help me?
*Javascript only, duh
I have fixed the problem, with the help of the people that answered. The Debug.Log was not going through, as it was turned off in the console (I don’t know why???). Also, the order in which the functions were being called was wrong. Instead of going
1. Disablescols
2. Enablephysics
3. GameObject.FindGameObjectWithTag(“fuse”)
It had to go
1. GameObject.FindGameObjectWithTag(“fuse”)
2. Disablescols
3. Enablephysics
as the enablephysics () function requires a rigidbody to work.
Thanks guys!!

I think the code is breaking here →

for(var k = 0; k <= probes.length; k++)

Because you are checking upto equal. Once the code breaks, it wont continue executing with the right behaviour.

Not sure though. :stuck_out_tongue: