- Home /
Question by
Razputin · Apr 30, 2016 at 01:25 AM ·
buildvector3build-errorzero
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
Script
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?
Comment
Could it be because I was running fraps and tanking my FPS?
Answer by NorthStar79 · Sep 19, 2017 at 02:28 PM
just add this line of code before Line 12 :
if(lookPos.magnitude != 0)
if your problem still goes on, search your problem somewhere else.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
iPhone build is a blank scene 0 Answers
Lighting layers error 1 Answer
Android Build 0 Answers