Get Some Crazy Errors In Game - Crazy!! (NaN)

Okay, My game so working great! ... Up till now!

All I have done is changed two variables from state var, to just var (damage, and fireRate) - these are parts of the machine gun script in the FPS tutorial, I have just modified it slightly to work on a turret.

To The Point:

Like I said, all I have done is changed these two variable types. Now when I place my turret into a prefab and duplicate it around the map, I get a LOAD of errors, here are a few:

!CompareApproximately(Sqr

transform.rotation assign attempt for "Camera Orbi" is not valid. Input rotation is {NaN, NaN, NaN, NaN}.

transform.rotation.assign attempt for "Enemy0(Clone) is not valid. Input rotation is {NaN, NaN, NaN, NaN}.

Now, even when I'm not playing my game, and I'm just in the editor, I get an error for the scene camera (rotation NaN, NaN) and I can't even use that for editing - even when I change back my variables in my script.

What The Heck Is Going On?

How even these two variables caused such a massive melt down? All these variables do is control the turret firing.

Please Help

--- When I create e completely new project, I still get that scene camera error: ---

transform.rotation assign attempt for 'SceneCamera' is not valid. Input rotation is { NaN, NaN, NaN, NaN }. UnityEditor.WindowLayout:LoadWindowLayout(String)

NaN means 'not a number'. The most common way to create a NaN is to divide by zero:

1 / 0 = NaN

The problem is that NaNs propagate very quickly, so any float which is calculated using a NaN becomes a NaN:

1 + NaN = NaN
2 * NaN = NaN

It's not clear whether the NaNs came from your code or not, if you're seeing in the editor it might suggest that something inside Unity has gone wrong. Try to identify which objects have NaNs, delete those objects and recreate them.

Okay ... So that was a retarded bug in Unity. I fixed it though. As much as the errors look as intimidating as they are. After creating many new fresh projects ... reinstalling, downloading rebooting. Nothing -

All I simply did was close the scene window, and now everything works ...

I think someone might want to report this error to Unity?!

I have no idea what you did, and I don't think anyone would know, but I'd suggest re-installing Unity. That should fix the problem.

I get the same error,too.I just drag the scene window,and then I solve it.
It’s so crazy!

I know this is an old thread, but I hope to help some. I was using the 2D feature with an animation and for me the problem was that I had a frame on the 0.0 frame of my animation. I just moved it a bit and it fixed everything. 0,o

I found a similar workaround to one that I use for Maya. Open the .unity scene file in a text editor and find and replace NaN with 0. That fixed it for me.

Make sure your Time.timeScale is set to a non-zero value. I kept getting this error when loading a scene because I had set Time.timeScale = 0 when my player dies, and I never set it back to 1 if they reloaded the scene.

i made a rolling cube game , iam getting the errors:

transform.position assign attempt for ‘Main Camera’ is not valid. Input position is { NaN, NaN, NaN }.
UnityEngine.Transform:set_position(Vector3)
followscript:Update() (at Assets/scripts/followscript.cs:10)

Invalid AABB a

while playing it , please help me !!!