create new gameobject unity

Code Example - create new gameobject unity

                
                        // Create GameObject with the name "name".
GameObject newLocation = new GameObject("name");
                    
                
 

unity create empty gameobject in code

                        
                                objToSpawn = new GameObject("Cool GameObject made from Code");
                            
                        
 

unity instantiate

                        
                                // You can use the 'Instantiate()' function to clone a GameObject
clone = Instantiate(original);

// You can also set the position, rotation and parent
clone = Instantiate(original, new Vector3(0, 0, 0), Quaternion.identity, cloneParent.transform);