I have a list of GameObject , and I need to know which one is the last in the hierarchy ( This is for a UI system, So is kind of 'which one is showing up')
I have a cursor managed by GamePad , and I use Raycast to see if he clicked something, It give me an array of Gameobjects but I need to know which one is showing up(on top of the others) to click on it
Example this is my full hierarchy:
GameObject A GameObject B GameObject C GameObject D GameObject E GameObject F GameObject G GameObject H GameObject I GameObject J
The list of raycast contain 'GameObject D','GameObject A','GameObject I'
How I cand find that 'GameObject I' is the last one? they don't have a common root