Hi, I’ve created a code that gets the localscale value and transforms it into a string then changes its unit of measurement to centimeters by multiplying it to 10. Problem is, it doesnt seem to work, are there any ways to add/subtract/multiply the localscale value that I’ve converted into string? Here’s my vanilla code without formulas.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class ScaleSlider : MonoBehaviour {
public Slider sliderLength;
public Slider sliderWidth;
public Slider sliderHeight;
public Text textLength;
public Text textWidth;
public Text textHeight;
// Use this for initialization
void Start () {
sliderWidth.value = 1f;
sliderLength.value = 1f;
sliderHeight.value = 1f;
}
void Update () {
textLength.text = transform.localScale.x.ToString();
textWidth.text = transform.localScale.y.ToString();
textHeight.text = transform.localScale.z.ToString();
transform.localScale = new Vector3(sliderLength.value*1, sliderWidth.value*1, sliderHeight.value*1);
}
}