I have a canvas object. I right click it and add a Button, which defaults to having a rect transform, image script, button script and text child object. I make it a prefab and delete it from my canvas. I want to have a data driven engine so I have an external list which I want to make into buttons. When I have my list loaded I attempt to create dynamic buttons by:
GameObject prefabButton = new GameObject("StandardButton");
This in the hierarchy but it doesn’t have the image or button or text components added, only a transform.
Why doesn’t it have the things the prefab has??
I read I might need to instantiate it, so I tried:
GameObject stdButton = (GameObject)Instantiate(prefabButton);
Again this creates another object in my hierarchy with nothing but a basic transform.
What is the difference between this object and the one I created before? Why instantiate at all?