unity create empty game object code example
Example 1: unity instantiate empty gameobject
GameObject newObj = new GameObject("Name");
Instantiate(newObj, Vector3.zero, Quaternion.identity);
Example 2: how to create empty ui object unity
GameObject myGO = new GameObject("MyGO", typeof(RectTransform),typeof(Button));
Example 3: unity create empty gameobject in code
objToSpawn = new GameObject("Cool GameObject made from Code");