- Home /
One List of GameObjects of different types...
Hello,
I am trying to create a list of GameObjects. I have a canvas with buttons to generate a cube and a sphere, then I have a clear button. I want to create a list that will be able to contain both the cubes and the spheres, then have the clear button to clear all of them. I found a good example that comes close to what I'm trying to do, but all of the examples I see only function with one GameObject... I want to put multiple prefab instantiations into this list. (Not create new ones with each button press). I have prefabs I will be instantiating, I need the list to contain them.
Right now I am creating an empty game object to manage the list, how do I create the list and have the buttons generate the required objects, and then tell the list that it needs to add those objects to it?