create gameobjct from scratch unity code example
Example: how to create empty ui object unity
GameObject myGO = new GameObject("MyGO", typeof(RectTransform),typeof(Button));
GameObject myGO = new GameObject("MyGO", typeof(RectTransform),typeof(Button));