using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ObjectScaling : MonoBehaviour {
public float scaleAmount = 2.0f;
public Vector3 originalScale = Vector3.zero;
void Awake()
{
originalScale = this.transform.localScale;
}
void Update ()
{
if(Input.GetKeyDown(KeyCode.G))
{
EnableScale ();
}
if (Input.GetKeyUp (KeyCode.G))
{
DisableScale ();
}
}
public void EnableScale()
{
this.transform.localScale = new Vector3 (scaleAmount, scaleAmount, scaleAmount);
}
public void DisableScale()
{
this.transform.localScale = originalScale;
}
}
when i try to scale the object through input…it’s scaling and then jumping off the plane