Zoom in/out Object

Hi, i have to zoom in/out my object(not camera) using pinch with min and max values.

using UnityEngine;
using System.Collections;

public class Zoom_Button : MonoBehaviour 
{
	private Transform Table_Transform = null;
	
	private float Scale_Factor = 0.5f;
	private bool Transform_Update = false;
	public GUITexture Zoom_In, Zoom_Out;
	
	// Use this for initialization
	void Start () {
		GameObject Table = GameObject.FindWithTag("Table");
		if (Table != null) 
		{
			Table_Transform = Table.transform;
		}
	}
	
	// Update is called once per frame
	void Update () {
		if (Transform_Update) {
			Table_Transform.localScale = 
				new Vector3(Scale_Factor, Scale_Factor, Scale_Factor);
			Transform_Update = false;
		}
		if(Input.touchCount > 0)
		{
			if(Zoom_In.HitTest(Input.GetTouch(0).position))
			{
				ScaleUp();
			}
			if(Zoom_Out.HitTest(Input.GetTouch(0).position))
			{
				ScaleDown();
			}
		}
	}
	
	void OnGUI() 
	{
		Vector3 scale;
		
		float ResolutionX 	= 1280;
		float ResolutionY 	= 728;
		
		scale.x 			= (float)Screen.width/ResolutionX;
		scale.y 			= (float)Screen.height/ResolutionY;
		scale.z 			= 1;
		
		Matrix4x4 svMat 	= GUI.matrix;
		GUI.matrix 			= Matrix4x4.TRS(new Vector3(0,0,0),Quaternion.identity,scale);
	}
	
	void ScaleUp() {
		if (Table_Transform != null) {
			Scale_Factor = Table_Transform.localScale.x;
			Scale_Factor *= 1.5f;
			
			Transform_Update = true;
		}
	}
	
	void ScaleDown() {
		if (Table_Transform != null) {
			Scale_Factor = Table_Transform.localScale.x;
			Scale_Factor *= 0.67f;
			
			Transform_Update = true;
		}
	}   
}

Right now am using this code to zoom in/out object, yes its working with button but i have to add min and max value for my zoom in/out and importantly i need a pinch zoom. I don’t know how to add those.

This tutorial on PINCH TO ZOOM does all the things you want but is for camera. You just need to adapt it to work with your current object scale instead of camera FOV.

There is also script available for that tutorial under the video. :slight_smile: