It looks like you're new here. If you want to get involved, click one of these buttons!
when i playing the game randomly this error appear and the score disappear and say NaN
the movement script
using UnityEngine;
public class playermovement3D : MonoBehaviour {
public Rigidbody rb;
public float forwdforce = 2000f;
public float sidewayforce = 500f;
// Update is called once per frame
void FixedUpdate ()
{
rb.AddForce(0, 0, forwdforce * Time.deltaTime);
if ( Input.GetKey("d") )
{
rb.AddForce(sidewayforce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
}
if (Input.GetKey("a"))
{
rb.AddForce(-sidewayforce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
}
if (rb.position.y < -1f)
{
FindObjectOfType<GameManager>().EndGame();
}
}
}