- Home /
How To Instantiate A GameObject That Is Inside A List To The Hierachy,How To Instantiate GameObjects Inside Of Lists?
Hello, I'm Sorry For Asking A Stupid Question. But I'm New In Using Lists And I Don't Know How To Instantiate A GameObject Inside A List, I'll Try To Explain. I Want To Have A List That Has GameObjects And In A Void, I Want To Make It To Find A Specific GameObject In A List Like : A GameObject Called "Knife" In A List And I Want To Have A Code To Locate That Knife In A LIst And Instantiate It From The List.
I Hope I Made You Understand What I Mean And I Hope Someone Could Help Me. -Zuku
Answer by gamer2300 · Jan 14 at 08:56 PM
GameObject are inside Scene, List types are inside source code. Any Hierarchy can be considered a list, so, inside source you can create a gameObject, after seek for the root of your "list" in scene, when find make the new gameObject child of root. So you put your gameObject inside a list on scene, at the same time if you have a list inside source code you can add new gameObject with add command.
So i can add a gameObject into a List and Then i could instantiate it, as the Hierachy is basically a list of it's own. Thanks For The Information. -Zuku