Hey, guys so what I’m trying to do is to scale gameobject towards x,y,z with different sliders. So the script that i have so far is
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class ScaleWithSlider : MonoBehaviour
{
public Slider z;
public Slider y;
public Slider x;
// Update is called once per frame
void Update()
{
transform.localScale = new Vector3(x, y, z);
}
}
,it was supposed to work in my mind ,but it’s not and unfortuanatelly i don’t know why i don’t got any error messages as well. Any help will be much appreciated. Thank you!
You definitely have errors. A Vector3 constructor takes 3 floats, you’re passing it three Sliders. Try doing “x.value, y.value, z.value” instead.
https://docs.unity3d.com/ScriptReference/UI.Slider.html
1 Like
Thanks for your quick answer it worked like charm. There is one more thing so the gameobject that i’m scaling is with a variable size and when i try to scale it with the slider it returns it back to the value of the slider. So how I can make to take the current value of the gameobject and then add value to it so it scales more. Thank you in advance 
If I’m understanding you correctly, you could do something like this:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class ScaleWithSlider : MonoBehaviour
{
public Slider z;
public Slider y;
public Slider x;
private Vector3 originalScale;
private void Start()
{
originalScale = transform.localScale;
}
// Update is called once per frame
private void Update()
{
transform.localScale = originalScale + new Vector3(x.value, y.value, z.value);
}
}
1 Like
Thanks for the answer ,but i just tested it on my device ,because i’m using pinch to scale and it’s not letting me scale it also i tried to scale it in the inspector while on play mode ,but it’s still not letting me to scale while the script is attached.
How do you expect pinch to scale and these sliders to interact? Do the sliders change when you pinch to reflect the new scale?
1 Like
Exactly what I’m trying to do is I have a gameobject which i can scale with pinch to zoom ,but what i’m trying to do other than that is to be able to transform the gameobject towards x and y with the sliders also the slider must be in the middle all the time and it shouldn’t be affected from the pinch to scale but when i want to transform towards x or y for example if i want to transform the gameobject towards x i should be able to move the slider left to make it thinner and right to make it wider. Thank you for helping me 
Your pinch to zoom shouldn’t be affecting the scale, you probably want to be changing the camera field of view. If the slider UI elements are under a screen space or camera space Canvas, then they can stay in place on screen when the zoom changes. Then the sliders alone will control the scale of the object.
1 Like
Thank you for your quick replies I can’t use the camera trick ,because i have other objects in the scene it seems like that i won’t be able to make it work with sliders instead i’ll be using buttons to do that. 
Sir, I want to show the dimensions of my object in the screen when i scale it by my android device. please guide me.