Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity create cube in script

void Start()
    {
    	/*GameObject != gameObject*/
        GameObject cubeObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
        
        /*if you need add position, scale and color to the cube*/
        cubeObject.transform.localPosition = new Vector3(0, 1, 0);
        cubeObject.transform.localScale = new Vector3(1, 1, 1);
        cubeObject.GetComponent<MeshRenderer>().material.color = Color.red  ;
    }
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# loop datatable rows 
Csharp :: how to do a foreach loop in c# for dictionary 
Csharp :: dotnet executable directory 
Csharp :: how to convert string to bool c# 
Csharp :: c# get all bytes of a file 
Csharp :: unity print to console 
Csharp :: read file c# 
Csharp :: c# set a guid 
Csharp :: unity instantiate empty gameobject 
Csharp :: c# string to double 
Csharp :: c# summary link 
Csharp :: create folder in appdata c# 
Csharp :: unity raycast all layers except one 
Csharp :: unity spawn object at position 
Csharp :: scenemanager c# 
Csharp :: c# current thread id 
Csharp :: how to change the extension of a file C# 
Csharp :: unity know when gameobject presed 
Csharp :: unity flexiable space 
Csharp :: system.text.json DeserializeAsync when to use 
Csharp :: c# connection string 
Csharp :: mouse click unity raycast unity 
Csharp :: how to insert qoutation marks into string c# 
Csharp :: unity button addlistener 
Csharp :: find many object with tag unity 
Csharp :: c# open file in default program 
Csharp :: unity how to get fps c# 
Csharp :: c# checksum 
Csharp :: ensuresuccessstatuscode exception 
Csharp :: unity destroy self 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =