How to scale object ingame with slider ?

Hi, im working at some application that ingame, i want when i touch guiButton, the slider is displayed at the bottom of screen (android devices), and the slider is for resizing the x , y and z from X object, what method can i use for this problem ?

thanks before :slight_smile:

ps : i’ve read this Unity - Scripting API: EditorGUILayout.Slider
but still i don’t know how to figure things out :s

I agree with robert about needing to research, but I will answer your question anyway (sorry).

I assume you want to scale an object in all directions. First off, in your script you could have the following:

private float objScale = 1;

void OnGUI()
    objScale = GUI.HorizontalSlider(new Rect(0, 0, 100, 40), objScale, 0f, 100);
        transform.localScale = new Vector3(objScale, objScale, objScale);


This will scale your object between 0 and 100.