QUESTION
Hola! I’m trying to make my own custom hierarchy window (more of an overlay on the original hierarchy window), and I’m trying to have the objects that are visible in the hierarchy window to alternate in color (their background at least). So, drawing the background and such isn’t my issue. My question is, how do I get an objects index in the hierarchy window? Child objects that are hidden shouldn’t be included in the index list, but the “counting” does need to start from the top object in the window.
MY ATTEMPTS
I have been using EditorApplication.hierarchyWindowItemOnGUI to call my function that handles the drawing of the stuffs, so I just started a counter using the first object that is called with the function and alternate the colors with that. However, this is flawed, because this is only called for VISIBLE items in the hierarchy window. Which means the very top object in the window isn’t going to be the first object that is called using this function. Sooo, that won’t work. I’m thinking I’d need to use a different thing to keep track of its index in the hierarchy window (while properly ignoring hidden children). Alternatively, if anyone knows how to find the collapsed state of an object in the window, like figure out if it is collapsed or not, that would solve my problem too, because I can use that to find the proper indices. I know reflection can be used to set an object to collapsed or not, but I haven’t found like a IsCollapsed kind of thing yet.