Closing last used window (gameobject) by esc
Hi Guys,
I try to make a game where player gets possibility to open some windows like inventory, equipment or journal. They all are different objects on same canvas, they could stay active in same time and they could be even grabbed and dragged to different position on canvas. It's pretty easy to enable/disable them by shortcuts or by icons on HUD but I wonder how good it would be if player could press Esc to close last used window. Unfortunately, I have no idea how to achieve such solution (it's why I didn't attached any code). It's not really important functionality but I think it's intuitive for a player.
I would be grateful for any advices.
Answer by CDAXRC · Nov 16, 2018 at 08:48 PM
1.Create GameObject list called like lastWindowList 2.By opening new window, add them to list 3. By pressing ESC disable first object in list and remove from list