How can I prevent Input position is {NaN, NaN, NaN} error?

Hi, I get this error ever so often but its not consistent so I cant tell whats causing it. After awhile or sometimes right away my player gets stuck and I get this rigidbody error:

rigidbody.position assign attempt for ‘Man2(Clone)’ is not valid. Input position is { NaN, NaN, NaN }.
UnityEngine.Rigidbody:MovePosition(Vector3)
SCR_character:UpdateMovementFixed() (at Assets/UAGK/Scripts/SCR_character.cs:263)
SCR_character:FixedUpdate() (at Assets/UAGK/Scripts/SCR_character.cs:251)

Here is line 263:

GetComponent().MovePosition(new Vector3(GetComponent().transform.position.x,0f,GetComponent().transform.position.z)+(speed[0]*Time.deltaTime));

Is there a simple work around or how can I go about identifying the probllem?

NaN means “not a number” (look it up and check.) It means you made a mistake somewhere in your program and got a junk value. Often dividing by 0.

It’s, obviously, contagious. So, your position is probably bad because something in the equation to make it is bad. I’d guess there’s an error with your speed. Do the usual, add Debug lines, etc… to check it. Sometimes if you aren’t moving, you can get funny errors with speed/facing.