Answers for "how to get the scale of an gameobject unity"

C#
20

unity set object scale

//gets the local scale of an object
vector3 local = transform.localScale;

//sets the local scale of an object
transform.localScale = new Vector3(scaleX,scaleY,scaleZ);

//gets the world scale of the object but is read only
vector3 world = transform.lossyScale;
Posted by: Guest on June-13-2020
1

change scale of an object unity

public GameObject cube;
    public Vector3 sizeChange; // This has to be set for (x,y,z) in the editor
    //public float cubeSize = 0.2f;

    void OnMouseDown()
    {
        cube.transform.localScale = cube.transform.localScale - sizeChange;    
    }
Posted by: Guest on October-20-2021

Code answers related to "how to get the scale of an gameobject unity"

C# Answers by Framework

Browse Popular Code Answers by Language