Drag Camera 2D – Unity Asset

Sharing is caring!

Drag Camera 2D – Unity Asset

The Drag Camera 2D asset is an asset in the Unity asset store that allows you to add drag controls to your camera. You can drag the camera to move horizontally or vertically across the unity world.This type of camera is ideal for top down RTS games where the controls need to be similar to games like Civilization and Command and Conquer. It is available on the Unity Asset Store here.

[embedyt] https://www.youtube.com/watch?v=Ej0W_UAdMEw[/embedyt]

Drag Camera 2D – Adding to your Game

This asset aims to be as simple as possible to use so only requires you to click and drag the asset from your assets folder and drop it on the Main camera. Alternatively you can click your main camera and add component and search for DragCam and it should appear as a selectable object.

Drag Camera 2D – Features

  • The main goal of this asset is to allow the user to simple add this script to a camera and have the camera respond to user click and drag movements without any coding.
  • The act of dragging the camera (moving horizontally or vertically) with the mouse or keyboard input has been added to the script which can be added to a camera to allow the user to manipulate the view based on the users click and drag movement.
  • The camera can have limits set to stop the camera being dragged out of the desired viewing area.
  • The camera can zoom in and out with the scroll wheel with limits on minimum and maximum zoom as well as setting the amount to zoom in and out with each increment of the scroll wheel.
  • Drag Speed can be adjusted.
  • Linked Zoom Drag can be toggled to keep dragging proportional to the zoom level.

Drag Camera 2D – Options


  • Panning Enabled toggles the ability to move horizontally or vertically with the mouse.
  • Pan Speed allows the speed of the drag to be adjusted.
  • Keyboard Input toggles the ability to move horizontally or vertically using the keyboard.
  • Inverse Keyboard toggles inverting both the horizontal and vertical direction for keyboard input.


  • Zoom enabled toggles whether the user can zoom in or out.
  • Linked Zoom Drag toggle whether the drag motion scales with the zoom.
  • Max zoom is the maximum zoom level allowed.
  • Min Zoom is the minimum zoom allowed.
  • Zoom Step Size is for setting the amount of zoom applied per click of the scroll wheel.

Limit Camera Area

  • Clamp Area toggle whether the camera should be restrained within the bounds set in the min/max inputs below.
  • Camera Max Y is the maximum Y value the camera should be allowed to go in unity units.
  • Camera Min Y is the minimum Y value the camera should be allowed to go in unity units.
  • Camera Max X is the maximum X value the camera should be allowed to go in unity units.
  • Camera Min X is the minimum X value the camera should be allowed to go in unity units.


Drag Camera 2D Pro – Unity Asset

The pro version has some additional functionality such as target following, edge scrolling and a dolly system as well as some improvements for ease of use such as GUI elements for adjusting the Camera bounds.

Follow Target.

You can tell the camera to follow a target by simply dropping the game object you want to follow into the Follow Target box on the DrageCamera2D component. Additional settings include the lerp speed for smoother target following and an offset  for adjusting the cameras offset from the target.
Follow Target

Camera Bounds

GUI Buttons

The camera bounds for pro users can be created by clicking the Create Bounds button in the DragCamera2D component. This will add a new CameraBounds object to the scene where you can adjust the bounds of the camera using the handles provided in the Scene view.

Camera Bounds gif

Dolly Camera Rail System

The dolly system allows the camera to move along a rail with a target. To create a dolly rail click the Create Dolly and one will be generated in the scene and attached to the DragCamera component. Once created you can adjust the Dolly waypoints by selecting the dolly and then moving the waypoints in the scene view. Additional waypoints can be added by clicking the add waypoint button.

Camera Dolly System

Sharing is caring!

One Reply to “Drag Camera 2D – Unity Asset”

  1. […] The original asset description and information can be found on this site here Drag Camera 2D – Unity Asset […]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.