IndexOutOfRangeException: Array index is out of range. CarController.Update

This is for CarController.cs error at line 105 that is starting at " float optimalSteering = angle … " on the script below:

void Update () 
	{
	
		// Steering
		Vector3 carDir = transform.forward;
		float fVelo = rigidbody.velocity.magnitude;
		Vector3 veloDir = rigidbody.velocity * (1/fVelo);
		float angle = -Mathf.Asin(Mathf.Clamp( Vector3.Cross(veloDir, carDir).y, -1, 1));
		float optimalSteering = angle / (wheels[0].maxSteeringAngle * Mathf.Deg2Rad);
		if (fVelo < 1)
			optimalSteering = 0;
				
		float steerInput = 0;
		if (Input.GetKey (KeyCode.A) && controlsEnabled)
			steerInput = -1;
		if (Input.GetKey (KeyCode.D) && controlsEnabled)
			steerInput = 1;

		if (steerInput < steering)
		{

else if (steerInput > steering)
		{
			float steerSpeed = (steering<0)?(1/(steerReleaseTime+veloSteerReleaseTime*fVelo)) :(1/(steerTime+veloSteerTime*fVelo));
			if (steering < optimalSteering)
				steerSpeed *= 1 + (optimalSteering-steering) * steerCorrectionFactor;
			steering += steerSpeed * Time.deltaTime;
			if (steerInput < steering)
				steering = steerInput;
		}

This means that your wheels array length equals 0 (it is empty). You might want to check if it ever gets filled befor update is called. Additional code would help to identify the problem.

Yes error still at that line.

I even try to reproduce the error on original scene by messed up the script and object but failed

I wonder what cause it or maybe something to do with my scene that co-operate with line above which I didn’t notice on the original scene