[HELP]Simplest Drag Script.

It’s been a month since i start learning/creating drag script
i already have 5 scripts already, they’re working but they’re complicated to edit with since i need to change some things to make it work it others

Can someone please give me a code of SIMPLEST DRAG script?
What i am trying to achieve is. I have this 3D Object that i want to move in just Z and Y position in Touch.
that’s it.

Hello, @Copenhagenn!

Have you tried searching Google? There are a bunch of great answers out there :slight_smile: Anyways, here’s a script:

 using UnityEngine;
 using System.Collections;
 
 public class TouchDrag : 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(0, touchDeltaPosition.y * speed * Time.deltaTime, touchDeltaPosition.z * speed * Time.deltaTime);
         }
     }
 }