The top down camera is used in games such as Civilization, Warcraft 3, XCOM, TAVERN MASTER, PRISON ARCHITECT, etc.d
Steps
- Create script TopDownCamera.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | using UnityEngine; public class TopDownCamera : MonoBehaviour { [SerializeField] private int _moveSpeed; private void Update() { Vector3 mouse = Input.mousePosition; if (mouse.x <= 0 || Input.GetKey(KeyCode.A)) { Move(Vector3.left); } else if (mouse.x >= Screen.width || Input.GetKey(KeyCode.D)) { Move(Vector3.right); } if (mouse.y <= 0 || Input.GetKey(KeyCode.S)) { Move(Vector3.back); } else if (mouse.y >= Screen.height || Input.GetKey(KeyCode.W)) { Move(Vector3.forward); } } private void Move(Vector3 position) { transform.Translate(position * _moveSpeed * Time.deltaTime); } } |
- Add script to top down object and move Main Camera to the object

Result
You can use keyboard or mouse to control
