Answers for "unity get size of a gameobject"

C#
0

getting the size of a gameobject

//Most common
transform.localScale
//People say this works
//Actual size of mesh , scaled to localScale
objectSize = Vector3.Scale(transform.localScale, GetComponent().mesh.bounds.size);
Posted by: Guest on October-21-2020
4

change size of a unity object

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 "unity get size of a gameobject"

C# Answers by Framework

Browse Popular Code Answers by Language