I have a problem on camera movement

I want to make camera follow the object without change rotation.

using UnityEngine;
using System.Collections;

public class CameraScript : MonoBehaviour
{
    public Transform target;
    private Vector3 offset;
   
    void Update ()
    {
               
        if(Input.GetKey(KeyCode.RightArrow))
        {
            transform.RotateAround(target.position, Vector3.down, 60 * Time.deltaTime);
        }
        else if(Input.GetKey(KeyCode.LeftArrow))
        {
            transform.RotateAround(target.position, Vector3.up, 60 * Time.deltaTime);
        }       
    }
   
}

Please help me.
Thanks very much.

I forget to tell you that I want the camera to rotate around the object. :slight_smile:

You can search for Unity Standard Assets and download the camera package. If you have them installed you can also access the packages via the Assets → Import Package menu in the editor. There you can look at different basic examples.

Generally you can work with a combination of transform.LookAt to make the camera look at a target and then set the camera position equal to a target position + offset.

Other than that I’m unsure what exactly you are trying to achieve given your explanation an the code sample.