rigidbody.velocity values are inconsistent

I’m writing a CharacterController as a demo exercise for my students in MacEwan University’s Game Programming course and ran across a strange problem. I get different values for rigidbody.velocity if I display it in Update vs. in FixedUpdate, the value is all zeros or very close to it whereas the value in Update is more consistent with the movement on screen. In an attempt to find the source, I’ve stripped everything out. Here’s the code I’m using:

using UnityEngine;
using System.Collections;

public class Controller : MonoBehaviour {

	void Update() {
		Debug.Log ("U " + rigidbody.velocity.x + "," + rigidbody.velocity.y + "," + rigidbody.velocity.z);
	}

	void FixedUpdate () {
		Vector3 vN = rigidbody.velocity;

		Debug.Log ("P " + vN.x + "," + vN.y + "," + vN.z);

		float speed = Input.GetAxis ("Speed");

		Vector3 targetV = transform.forward * speed * 3.5f;
		
		Vector3 deltaV = targetV - rigidbody.velocity;
		deltaV.y = 0f;
		deltaV *= 1.0f/Time.fixedDeltaTime;

		rigidbody.AddForce (deltaV, ForceMode.Force);
	}
}

Output:

U 0.065167,1.3039E-9,1.46332
P 0,1.39039E-9,0

U is in Update
P is in FixedUpdate

I believe rigid body.velocity is in an indeterminate state during FixedUpdate.

In general the docs recommend that you not try to mess with rigid body.velocity on every frame but rather control it through forces.

So if I’m trying to have a particular change in velocity (i.e. I’m moving at rigidbody.velocity and I want to end up at targetV), I can only use rigidbody.velocity in Update. The resulting delta would become the force I apply in FixedUpdate …

All physics calculations must be done in fixedUpdate.