Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Zooming using the Mouse Wheel In-Game

Discussion in 'Getting Started' started by DiogoCosta, Feb 16, 2015.

  1. DiogoCosta

    DiogoCosta

    Joined:
    Feb 15, 2015
    Posts:
    12
    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?
     
    gazorpeth likes this.
  2. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,436
    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?
     
  3. DiogoCosta

    DiogoCosta

    Joined:
    Feb 15, 2015
    Posts:
    12
    I would like the camera to zoom onto the object (which is a gameobject) and I'm currently using a perspective camera.
     
  4. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,436
  5. DiogoCosta

    DiogoCosta

    Joined:
    Feb 15, 2015
    Posts:
    12
    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)'
     
  6. DiogoCosta

    DiogoCosta

    Joined:
    Feb 15, 2015
    Posts:
    12