Zooming using the Mouse Wheel In-Game

I am making a game, and I would like to be able to zoom in and out of a map and would like to know how to do that. Can anyone help, please?

1 Like

Several variables here… Do you want to zoom the Camera itself or the Object? Is the map a GameObject or Sprite? Are you using an Orthographic camera or Perspective camera?

I would like the camera to zoom onto the object (which is a gameobject) and I’m currently using a perspective camera.

Likely what you’re looking for:

1 Like

That doesn’t work I get a error message saying
‘NullReferenceException: Object reference not set to an instance of an object
CameraManager.Update () (at Assets/CameraManager.js:9)’

I found something that works Clamp Mouse Zoom using Scroll Wheel (SOLVED) - Questions & Answers - Unity Discussions

It maybe help to you

1 Like

I’d hope that they would’ve gotten this working within the 5 years after they posted this thread. :face_with_spiral_eyes:

@Vryken But remember that some people come to the thread much later, and can still use newer advice.

8 Likes