change scale of an object unity

Code Example - 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;    
    }
                    
                
 

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;
                            
                        
 

how to change the scale of a gameobject in unity

                        
                                vector3 world = transform.lossyScale;