Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. 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:
    7,381
    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:
    7,381
  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
  7. SaturnGamesss

    SaturnGamesss

    Joined:
    Feb 18, 2019
    Posts:
    1
    It maybe help to you
     
    Exhena likes this.
  8. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    I'd hope that they would've gotten this working within the 5 years after they posted this thread. :confused:
     
  9. jumisko

    jumisko

    Joined:
    Feb 18, 2020
    Posts:
    10
    @Vryken But remember that some people come to the thread much later, and can still use newer advice.