unity create object script code example
Example 1: clone gameobject unity c#
public GameObject rootObj;
void Start()
{
GameObject duplicate = Instantiate(rootObj);
}
Example 2: untiy instanciate prefab
Instantiate(prefab, new Vector3(i * 2.0F, 0, 0), Quaternion.identity);