- Home /
Hierarchy in game view?
Hello there,
I am currently looking into my game play environment and wanted to know that when you build the game is there anyway to make and populate a list like the hierarchy, I evidently want to be able to select a item and make it highlight the item. But for now im just looking at making a list like the hierarchy, or ideas on how I would go about it.
I have a few ideas on how something like this could be achived, althought I am struggling on how to make them interactive, my main idea was to add a tag to everything in the scene that I wanted to be listed, and output it in a gui scroll windows
Pseudocode :
empty list of root gameObjects
create a list of all gameObjects = get every gameObject in the scene
loop through all gameObjects
{
does this gameObject have a parent ?
NO : add it to the list of root gameObjects
}
now there is a list of objects with no parent
loop through root gameObjects list
{
create a button for current index gameObject, label with name of gameObject
give the button an index reference relating to this objects position in the root gameObjects list
}
empty variable to store the index of the current selected object
when the user hits a button,
call a function with the index of the button
{
is there is an object index stored in the currentIndex variable ?
YES : call a function on the gameobject at rootGameObjects[ index ] that will DISABLE an indicator renderer
call a function on the gameobject at rootGameObjects[ index ] that will ENABLE an indicator renderer
store the index in the currentIndex variable
}
This may not be what you need, i.e. you may have children of an empty gameObject you want to appear in the buttons. For this case : ins$$anonymous$$d of searching for all gameObject and finding their root object, ins$$anonymous$$d find all gameobjects with a specific tag or layer, make them the list of root gameObjects.
UA isn't really about design ideas or concepts, it is more for specific technical questions relating to code not working as desired. This type of discussion/design question is better suited for the forums. Good Luck