create new gameobject unity code example
Example 1: unity instantiate
clone = Instantiate(original);
clone = Instantiate(original, new Vector3(0, 0, 0), Quaternion.identity, cloneParent.transform);
Example 2: unity create gameobject
SpawnedObject = new GameObject("Created GameObject");
Example 3: create gameobject unity
using UnityEngine;
public class InstantiationExample : MonoBehaviour
{
public GameObject myPrefab;
void Start()
{
Instantiate(myPrefab, new Vector3(0, 0, 0), Quaternion.identity);
}
}
Example 4: unity create empty gameobject in code
objToSpawn = new GameObject("Cool GameObject made from Code");
Example 5: create new gameobject unity
GameObject newLocation = new GameObject("name");