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 :: c# array max 
Csharp :: c# alphabetize a list of string 
Csharp :: C# setting property values through reflection with attributes 
Csharp :: c# convert long to int 
Csharp :: save image in c# 
Csharp :: how to stop a form c# 
Csharp :: upload file using httpwebrequest c# 
Csharp :: how to write coroutine in unity 
Csharp :: C# new form 
Csharp :: check if value in list c# 
Csharp :: index of c# 
Csharp :: quotes in string f# 
Csharp :: enum c# 
Csharp :: c# itext 7 PdfDocument from byte array 
Csharp :: c# directory file 
Csharp :: wasd code for unity 
Csharp :: unity render to texture2d 
Csharp :: sorting list by date time dec in c# 
Csharp :: Search for a value into a list in c# 
Csharp :: c# combobox with text and value 
Csharp :: JsonConvert.DeserializeObject options camelcasing c# .net 
Csharp :: iterate though data in firebase unity 
Csharp :: unity list get item at index 
Csharp :: Scrollable WPF ListBox 
Csharp :: c# math method to reverse negative or positive 
Csharp :: unity unit tests 
Csharp :: remove scenedelegate 
Csharp :: c# write line 
Csharp :: c# access substring 
Csharp :: substring in c# 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =