- Home /
getting an error on camera while trying to change timescale
Hi I'm doing a platformer 2D game and when I'm trying to put my game to pause I use the Time.timescale = 0 . So when I press escape its goes to the pause menu and the time is stop. But when I try to put it to 1 or 0.5 whatever number i change to. I getting an error on my camera script. I'm using the camera script gived by unity (cameraScrolling script). Heres the part of code where I have got the error:
// You almost always want camera motion to go inside of LateUpdate (), so that the camera follows // the target after it has moved. Otherwise, the camera may lag one frame behind. function LateUpdate () { // Where should our camera be looking right now? var goalPosition = GetGoalPosition ();
// Interpolate between the current camera position and the goal position.
// See the documentation on Vector3.Lerp () for more information.
transform.position = Vector3.Lerp (transform.position, goalPosition, Time.deltaTime * springiness);
}
IN the exact line where the problem can be found is the transform one.
The error is :
transform.position assign attempt for Main Camera is not valid. Input position is {NaN, NaN, -5.0000}
So you have any idea how I could fix this?
Thx
Your answer
![](https://koobas.hobune.stream/wayback/20220613042016im_/https://answers.unity.com/themes/thub/images/avi.jpg)