Transform.position assign attempt for 'Enemy(Clone)' is not valid. Input position is {NaN, NaN, NaN}

From my research I can see I am getting a vector issue (it looks like I divide by 0 but I dont do an divisions in my script).

I checked every script I have for positions and tried to catch it between trace statements. Couldnt do it.

This error comes up SOMETIMES right as an enemy is killed.

I feel it has something to do with its position. Clicking on this error does nothing, but SOMETIMES it highlights the gameobject that got the bad transform passed to it.

Is there somewhere in your code I could get getting a NAN vector that I can look for?

Right as an enemy dies I will get a lot of these, and once its dead (destroyed) this problem goes away. Any ideas?


I haven’t seen anything in my code causing NaNs, so I am afraid I cannot help you.
Try logging every assignment of transform.position (or other things which modify the position) and check what the first log statement is that sets it to NaN.

It was a scale assignment! I had set the scale of an object to 0 which crashed it!