Xerios / ScreenManager

Flexible way to manage screens with transitions for Unity
MIT License
563 stars 69 forks source link

Any back button functionality? #9

Closed hex closed 6 years ago

hex commented 6 years ago

Hi there, is there any back button functionality? Maybe it could go through the screen stack and show the previous screen.

Xerios commented 6 years ago

Hide() already does this.

hex commented 6 years ago

It doesn't work for a specific case. I modified the Simple Test scene for demonstrating the behavior.

Steps:

  1. Open Window 2
  2. Open Window 1
  3. Open Window 2
  4. Go Back button

https://www.dropbox.com/s/hsd1b1qgy8eheuu/testCase.unitypackage?dl=0

Xerios commented 6 years ago

Your're right, that doesn't look right at all. I must've messed up somewhere, gonna try to fix it.

hex commented 6 years ago

I think it's related to the way that an element is removed from the list (screenQueue). This is the stack state before I press go back: Initial state and this is after I press go back: After state It seems that it removes the first instance of that window from that list. screenQueue.Remove(screenToKill)

Xerios commented 6 years ago

Right when you sent me the message I stumbled upon that as well.

Making it remove the last one doesn't get rid of the problem though.

Xerios commented 6 years ago

I found the issue and pushed the fix.

Thanks for notifying. This change might or might've not messed up hideCurrent functionality because I removed some strange looking code that looked really out of place, but I'm not sure though. I should've done some unit tests :'(

hex commented 6 years ago

I will let you know if I discover anything weird. Thanks for acting so promptly!

Xerios commented 6 years ago

I'll close this issue for now