Answers for "unity change scale of instantiated object"

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
0

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
0

instantiate scale object

GameObject newObject = Instantiate(objectPrefab, location, Quaternion.identity) as GameObject;  // instatiate the object
newObject.transform.localscale = new Vector3(whatever.x, whatever.y, whatever.z); // change its local scale in x y z format
Posted by: Guest on February-23-2021

Code answers related to "unity change scale of instantiated object"

C# Answers by Framework

Browse Popular Code Answers by Language