Screen Controller is an elegant way of dealing with many Screens in Unity3D. HOW TO USE THIS METHOD?
- Copy ScreenController and screen scripts.
- Import them into your project.
- Create you screens and put them as a child of a gameobject.
- Now add ScreenController to that gameobject.
- Its time to create a screen, inherit screen class into your customise screen and assign appropriate screen ID to them.
- This Screen ID is going to be an enum which is declare in ScreenController extend this end accourding to you screens.
- Each screens which inherit from screen class can override function like Show() and Hide().
- This function gonna act as an entry and exit points in the screens.
- And if you want to add some customize animation to the screens just like in the demo then coustomize the ScreenSlideAnimation class accordingly.
- There is a boolen variable inside ScreenSlideAnimation class called allowAnimation if there is a need to avoid animation on some classes. Please set it false from inspector.
Why you should use this method?
- Simple and easy to implementation.
- Can able to goto any screen without worrying about unable and disable any gameobject.
- Easy to scale without breaking exiting code.
- Can traverse to previous screens with back function.
- Ever screen will get informed when any screen is enabled or disabled.
- Gives the ability to added custom animations to screens.