Camera 2D Movement android unity

Hi,

I m touching a camera in my android device and it moves with touch but i want to limit it’s moves in X and Y axis , here is the code that let me move the camera.

using UnityEngine;
using System.Collections;
 
public class Example : MonoBehaviour
{
    public float speed = 0.1F;
    void Update() {
        if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved) {
            Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition;
            transform.Translate(-touchDeltaPosition.x * speed * Time.deltaTime, -touchDeltaPosition.y * speed * Time.deltaTime, 0);
        }
    }
}

Thanks for your help

I Found a Solution for my problem. now i can touch on device screen to go left , right, up and down .

This script is attached to the main Camera. this script let me move the camera and let me limit it’s moves in X and Y axis:

 float maxXleft = -13.0f;
 float maxXright = 14.0f;
 float maxYleft = -7.0f;
 float maxYright = 18.0f;
 
 #region Touch Mobile

        if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved)
        {
            Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition;
            transform.Translate(-touchDeltaPosition.x * speed * Time.deltaTime, -touchDeltaPosition.y * speed * Time.deltaTime, 0);

            Vector3 tmpPosX = transform.position;
            tmpPosX.x = Mathf.Clamp(tmpPosX.x, maxXleft,maxXright);
            transform.position = tmpPosX;
            

            Vector3 tmpPosY = transform.position;
            tmpPosY.y = Mathf.Clamp(tmpPosY.y,maxYleft, maxYright);
            transform.position = tmpPosY;
            
        }
        #endregion