Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

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;
Comment

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;    
    }
Comment

PREVIOUS NEXT
Code Example
Csharp :: convert base64 string to string c# 
Csharp :: c# new line in messagebox 
Csharp :: split with multiple delimiters c# 
Csharp :: unity enable gameobject 
Csharp :: c# windows grab screenshot 
Csharp :: c# get full URL of page 
Csharp :: Animator.GotoState: State could not be found UnityEngine.Animator:Play (string) 
Csharp :: c# print to console 
Csharp :: randomize through array in C# 
Csharp :: detecting a right click unity 
Csharp :: how to get an child of an gameobject 
Csharp :: add two numbers in c# 
Csharp :: unity or 
Csharp :: serilog loglevel order 
Csharp :: c# string to sha256 
Csharp :: manchester united 
Csharp :: unity spawn object at position 
Csharp :: how to play video in ui unity 
Csharp :: stop process c# 
Csharp :: unity get project file directory 
Csharp :: c# get project directory 
Csharp :: C# console app how to run another program 
Csharp :: c# double value with 2 decimal places 
Csharp :: unity rigidbody freeze all 
Csharp :: {} is this used for code blcoks in c# 
Csharp :: unity destroy object on collision 
Csharp :: how to log out of unity asset store 
Csharp :: c# console writeline array 
Csharp :: asp.net throw unauthorized exception 
Csharp :: visual studio windows form exit button 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =