Game works fine in editor. Bugs out super hard in built version. Look rotation viewing vector is zero.

Error I receive in the logs from the built version.

Look rotation viewing vector is zero


    private GameObject player;

    void Start ()
        player = GameObject.FindGameObjectWithTag("Player");

    void Update()
        Vector3 lookPos = player.transform.position - transform.position;
        lookPos.y = 0;
        var rotation = Quaternion.LookRotation(lookPos);
        transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * 10);

I do not receive this error in the editor. The game runs and plays fine. Why does this error only pop up in the built version of the game and not while playing in the editor?

just add this line of code before Line 12 :

if(lookPos.magnitude != 0) 

if your problem still goes on, search your problem somewhere else.