how to make a camrea to rotate around a gameobject when drag mouse?
There is a script supplied in the Scripts package in Unity's Standard Packages which almost has this behaviour - it orbits the object, but at all times, not just dragging. We can modify it to do this though!
To find it, either import the Scripts package when you create a new project, or to add it to an existing project, go to Assets -> Import Package, then browse to the Standard Packages folder inside the Unity application (program) folder.
It is in Scripts / Camera Scripts / Mouse Orbit
To use, place the script on your camera, then set the "Target" by dragging your target object into the target slot in the inspector.
A very simple modification to make the script work only when dragging, is this:
Double click on the script to edit it, and change line 26 from this:
if (target) {
to this":
if (target && Input.GetMouseButton(0)) {
Good luck!