• Как сделать границы камеры?

    @Lunniy174
    float speed = 6f;
    public Transform target;
    public Transform leftdown;
    public Transform rightup;

    private float xmin;
    private float xmax;
    private float ymin;
    private float ymax;
    private Vector3 position;
    // Start is called before the first frame update
    void Start()
    {
    Calk();
    }

    // Update is called once per frame
    void Update()
    {


    position = new Vector3(Mathf.Clamp(target.position.x, xmin, xmax),
    Mathf.Clamp(target.position.y, ymin, ymax), transform.position.z);


    print(xmin);


    transform.position = Vector3.Lerp(transform.position, position, speed * Time.deltaTime);


    }
    private void Calk()
    {
    Vector3 min = Camera.main.ViewportToWorldPoint(new Vector3(0, 0, Camera.main.nearClipPlane)); //Получаем вектор нижнего левого угла камеры
    Vector3 max = Camera.main.ViewportToWorldPoint(new Vector3(1f, 1f, Camera.main.nearClipPlane));

    float x_left = leftdown.position.x;
    float x_right = rightup.position.x;
    float y_up = rightup.position.y;
    float y_down = leftdown.position.y;

    xmin = transform.position.x - (min.x - x_left);
    xmax = (x_right - max.x) + transform.position.x;
    ymin = transform.position.y - (min.y - y_down);
    ymax = (y_up - max.y) + transform.position.x;

    position = new Vector3(Mathf.Clamp(target.position.x, xmin, xmax),
    Mathf.Clamp(target.position.y, ymin, ymax), transform.position.z);

    }


    Камера плавно следующая за персонажем, с границами по точкам.
    В инспекторе персонажа ставь на target.
    И две точки для границ камеры.