0
votes

I am getting this error when testing the game:

transform.position assign attempt for 'Main Camera' is not valid. Input position is { 0.000000, 1.690000, NaN }. UnityEngine.Transform:set_position(Vector3)

This is the camera script:

using UnityEngine;

public class CameraController : MonoBehaviour {

    public GameObject player;
    private Vector3 offset;

    // Use this for initialization
    void Start()
    {
        offset = transform.position - player.transform.position;
    }

    // Update is called once per frame
    void LateUpdate()
    {
        transform.position = player.transform.position + offset;
    }
}

Do you know how to fix that?

1

1 Answers

0
votes

Simply reset the Camera Transform in the inspector. That should clear the error.