I have a working zoom function for my top down 2D game:
using UnityEngine;
using System.Collections;
public class ZoomFunction : MonoBehaviour {
public float zoomSpeed = 20;
void Update () {
float scroll = Input.GetAxis ("Mouse ScrollWheel");
if (scroll != 0.0f)
{
Camera.main.orthographicSize -= scroll * zoomSpeed;
}
}
}
It works but it jumps in and out rather than being a smooth transition and I would like to set limitations to how far in or out the player can zoom. Any help/advice would be appreciated.