# Unity: camera moving up and down for no reason

I have a standard camera in my scene. With standard I mean the camera you get when you click right mouse > Camera, with no modification except for the transform position and rotation. Then I attached to the camera this simple script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraController : MonoBehaviour {

public GameObject target;
public Vector3 translationOffset;
public Vector3 rotationOffset;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
transform.position = target.transform.position + translationOffset;
transform.LookAt(target.transform);
transform.Rotate(-rotationOffset);
}


}

the result I have is this:

Why my camera is doing that? It may be worth noticing that everything was working fine, but at some point i clicked on "reimport all assets" and it started this weird behaviour. How can I fix? Thanks a lot.

• There's nothing obvious in what you've shown that would cause this. Do you have any other scripts that might be influencing the camera position? – DMGregory Jun 3 '18 at 20:24
• @DMGregory not really, those are the only two object in the scene and the only script is the one on the camera I pasted in my question. However I deleted and I did everything back from scratch; now everything is working as expected. – JoulinRouge Jun 3 '18 at 20:33
• Hmm when looking at the script component, the variables aren't changing, so I don't think this script is causing the issue... – Saryk Jun 3 '18 at 21:58