!CompareApproximately (det, 1.0F, .005f)

I’ve got a big battle going on, lots of flying objects etc. Worked fine for days. Then all of a sudden I start getting these errors.

!CompareApproximately (det, 1.0F, .005f)
UnityEngine.Transform:LookAt(Transform, Vector3) (I have verified that the object to look at exists. and is within reasonable position within the scene.)

transform.position assign attempt for ‘Bullet’ is not valid. Input position is { NaN, NaN, NaN }.

transform.localRotation assign attempt for ‘MuzzleFlash’ is not valid. Input rotation is { NaN, NaN, NaN, NaN }.
UnityEngine.Transform:set_localRotation(Quaternion)

transform.rotation assign attempt for ‘Base’ is not valid. Input rotation is { NaN, -0.469401, 0.645964, 0.437326 }.
UnityEngine.Transform:set_rotation(Quaternion)

transform.position assign attempt for ‘CombatCamera’ is not valid. Input position is { NaN, NaN, NaN }.
UnityEngine.Transform:set_position(Vector3)

And then it just build up more and more.

Any Idea whats causing this? is this a Unity Bug?

It usually happens when you have a logical error somewhere in your calculations (for example division by zero) and you attempt to make a Quaternion based on that calculation.
The easiest way to reproduce this error is with code like this:

Vector3 v = Vector3.one;
v /= 0f;
Quaternion r = Quaternion.LookRotation(v);

So if you get this error, debug what your functions return and if there is a NaN or Infinity anywhere, it might be it.

Okay… Just solved my own problem. It seems that a missing reference to a script was causing this. Undetected by a try catch clause. This caused a chain reaction across my project, affecting everything mentioned above. Wow.

This wrecked my project. Lesson learned.