- Home /
Scaling Object with Slider
The question is very simple. I'd like to know on how can I scale an object by using sliders. My plan is to use three sliders to scale the object's Height, Length, and Depth. I've been reading tutorials and Q&A's but I dont seem to get the concept of using sliders to scale objects. Thank you in advance for your answers. Examples will be greatly appreciated :)
Answer by andzq · Oct 12, 2016 at 09:03 PM
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class ControlScaleWithSlider : MonoBehaviour {
[Range(0, 10)]
public float z = 1;
[Range(0, 10)]
public float x = 1;
[Range(0, 10)]
public float y = 1;
// Update is called once per frame
void Update () {
transform.localScale = new Vector3(x, y, z);
}
}
this script allows you to scale the object it is attached to in the inspector. I´m not sure if that is what you were looking for though.
Thank you! This definitely helped on the idea of I'm trying to do.
Your answer
Follow this Question
Related Questions
How do I scale an object or prefab to a size in Unity units? 1 Answer
Object changes shape randomly. 1 Answer
Object Rotation Sliders 1 Answer
How to find what object "scaling" number is 1 unit? 1 Answer
Why won't my object grow? 1 Answer