create gameobject programmatically unity code example
Example 1: how to create empty ui object unity
GameObject myGO = new GameObject("MyGO", typeof(RectTransform),typeof(Button));
Example 2: unity create empty gameobject in code
objToSpawn = new GameObject("Cool GameObject made from Code");