Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

[WIP] Unity Open Source Pause Menu

Discussion in 'Works In Progress - Archive' started by Eric2241, Feb 17, 2016.

  1. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    The Unity Open Source Pause Menu
    As the title suggests, I'm currently working on an open source pause menu built on UGUI, complete with video controls, and audio controls. Also included in this package are 2 UI Styles all for the price of free. Basically, as I'm working on my own game, New Horizons, I'm creating this pause menu. The asset will be release on both the asset store and Github. The asset store releases will be purely stable ones, while the Github ones will features the latest improvements/fixes. The release branch of the Github repo will mirror the asset store releases.



    Why free?
    As a emerging dev myself, I've hit a lot of road blocks in the process. But thankfully to a few great asset developers, that's been easier. However, my situation is not like everyone else, and not everyone is going to get the same help I've gotten, and so I want to help people out. I've also noticed that a large amount of UI assets are lacking on the asset store, for example, while there may be thousands of high quality models, there won't be nearly as many of UI assets.

    Why open source?
    First of all open source software is a great way to encourage innovation because it allows developers to build off of each other and collaborate, but also it's a way for me to allow the community to take what I've done and have free rein on any changes anyone wishes to make. That means I will be completely open to suggestions and will look over all pull requests.

    Why choose an open source solution over a paid one?
    Who doesn't love free stuff? But seriously, this asset is very powerful. Looking around the asset store, the features I have right now already surpass much of what the asset store has to offer. While the first releases may be buggy, there's a reasons it's a WIP. Also, since the community will play a part, chances are bugs will get hammered out. A complete list of features will be shown below.

    Features

    Fluid button sprite swaps/animations



    Fluid animations between panels



    Plenty of video settings to tweak

    There are fully implemented features such as adjusting the MSAA amount, aniso (force on, per texture, or disabled), vsync, FOV, Render distance, Terrain density, Shadow Distance, Model Quality (lod bias), iterating through presets, and many more such as toggling full screen. Other features have not necessarily been thoroughly tested and or are buggy, and some features have been coded, but not yet implemented into the UI. The gif below shows the features on the UI.



    A functional audio panel

    It controls the master volume, along with all of the music and sound effect audio sources specified in the manager.



    A rich manager

    The manager script controls everything. The script has a lot of options you can specify, for example the shadow distance at a particular quality level or the LOD bias at a particular quality level.

     
    Last edited: May 8, 2016
  2. Whiteleaf

    Whiteleaf

    Joined:
    Jul 1, 2014
    Posts:
    728
    I like the look of this. How did you go about editing global model quality?
     
  3. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Thanks! I used the lod bias setting since it does the job of dynamically changing the model quality if you have you assets set up in LODs. In future releases I may look into other solutions for people who don't have LODs setup.
     
    kfirmon and Whiteleaf like this.
  4. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Last edited: Feb 18, 2016
    kfirmon likes this.
  5. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    So before I go and create an editor script, does creating one seem necessary or is the inspector already good enough? Also, for all the testers out there, if you find a bug please open an issue on the repo for it. Thanks.
     
    Last edited: Feb 18, 2016
    kfirmon likes this.
  6. PhoenixRising1

    PhoenixRising1

    Joined:
    Sep 12, 2015
    Posts:
    488
    Thanks a lot, I was just about to implement something like this and now I won't have to. :)
     
    Eric2241 likes this.
  7. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    No problem, that's what it's there for. Be warned. There are bugs, mainly regarding the resolution changing, but I'm trying to fix that before an actual release.
     
    PhoenixRising1 likes this.
  8. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Resolution changing is now fixed.
     
    kfirmon likes this.
  9. FeedorFeed

    FeedorFeed

    Joined:
    Jan 9, 2014
    Posts:
    35
    This is fantastic! Keep it up
     
    kfirmon and Eric2241 like this.
  10. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Thanks!
     
  11. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    A lot of features have been implemented now, which means its almost time for another pre release. Check the repo in the upcoming days for a new pre release.
     
  12. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    kfirmon likes this.
  13. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
  14. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,510
    This is pretty phenomenal. Any plans to support controller input along with mouse?
     
    PhoenixRising1 and Eric2241 like this.
  15. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Thanks, I'll have to look into controller support because I'm not planning on controller support for my game. But, if a community member would like add support, I'd be happy to accept a pull request.
     
  16. PhoenixRising1

    PhoenixRising1

    Joined:
    Sep 12, 2015
    Posts:
    488
    I was gonna implement it myself but I would greatly appreciate if it was built in.
     
  17. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    It seems like it might be quite easy from this thread, but if you end up implementing it a pull request would be awesome.
     
  18. PhoenixRising1

    PhoenixRising1

    Joined:
    Sep 12, 2015
    Posts:
    488
    Yeah it's pretty easy but there's so much that needs to be done :). I will see when I can spend some time with it.
     
    Eric2241 likes this.
  19. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Awesome!
     
  20. EliasMasche

    EliasMasche

    Joined:
    Jul 11, 2014
    Posts:
    92
    Really thx a lot for this great asset, just in better time for when i start my new project of game, I will try to implement a controller support in my free time, right now i learning the new Unity networking. :D
     
    Eric2241 likes this.
  21. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    No problem, if you have a github account, staring the repo would help a lot!
     
  22. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    The canceling functionality for shadow cascades and texture limits was added to the repo.
     
  23. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Update: Sorry about the delay in updates, but school has started again, which is the cause of the lack of updates. The next update will come with controller support.
     
    EliasMasche and PhoenixRising1 like this.
  24. PhoenixRising1

    PhoenixRising1

    Joined:
    Sep 12, 2015
    Posts:
    488
    Now that's great news. I haven't had time to look at it yet due to an upcoming move. Appreciate it a lot.
     
    Eric2241 likes this.
  25. EliasMasche

    EliasMasche

    Joined:
    Jul 11, 2014
    Posts:
    92
    Really thanks a lot, appreciate too :), here i was some problem but was my fault, and beside i started my job too so didn't have time for add controller support and read your code.
     
    Eric2241 likes this.
  26. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,433
    I don't have a game yet that I could put a pause menu into, but if I ever have this one will be the first solution I'll be looking at. Thanks a lot for sharing and keep up the great work!
     
  27. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Thanks!
     
  28. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Thanks!
    Thanks!

    It will honesty take me another week or so before my schedule frees up, but it is coming!
     
    PhoenixRising1 likes this.
  29. EliasMasche

    EliasMasche

    Joined:
    Jul 11, 2014
    Posts:
    92
    No problem with that, in my case, my schedule is needed to pass at least 2 weeks before to be free again to start programming again. beside i need to deal with my study in the university
     
    Eric2241 likes this.
  30. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    I've updated the github repo. Check out the changes there.
     
    PhoenixRising1 likes this.
  31. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    The 0.5 release just went live! The asset is out of pre-release, and I am now creating the art for the asset store release of the asset.

    0.5 change log:
    Audio panel stabilized for release.
    Keyboard/Joystick control fixed for release.
    Namings of gameobjects changed for release.
    Code cleaned up for asset store.
    Build Created in builds folder.
    Zip file of docs added into the assets folder.
     
    PhoenixRising1 likes this.
  32. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Sorry for the delay, but the asset store submission process is extremely long and tedious. I will post when it's accepted.
     
    PhoenixRising1 likes this.
  33. ShatterGlassGames

    ShatterGlassGames

    Joined:
    Jan 14, 2016
    Posts:
    135
    This looks amazing but how can i make it work to only sow when I press Esc? I tried following the site instructions but it just places the menu in front of the player all the time. How can i make it only sow when i hit "Esc"? I would appreciate if some can please help me with this.

    GREAT MENU!
     
  34. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    First of all, thanks! Now on to your question. You should be able to get into the pause menu by pressing escape. If not make sure this if statement in the update method is still there.
    Code (csharp):
    1.  
    2. if (Input.GetKeyDown(KeyCode.Escape))
    3.  
    If that doesn't work then make sure that the panel is centered on the screen, and also make sure that there are not conflicting scripts. Try these first, and if these suggestions don't work then we'll figure something out.
     
  35. ShatterGlassGames

    ShatterGlassGames

    Joined:
    Jan 14, 2016
    Posts:
    135
    Ok so i got it to somewhat work with the "Pause Menu Scene" but i still get a couple error messages. If you can will it be possible if you make a quick youtube tutorial on how to get it going? This is a great asset and i really would like to use it in my project.
     
  36. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    You need to make sure that everything is assigned in the manager. Can you post a picture of your manager and console? Also, download the lastest GitHub repo, as in go to the repo's main page and click download zip. Try that version as it is much more stable than the latest release.
     
  37. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,663
    Mobile/touchscreen support? I guess being based on uGui it should work at least to some degree on mobile right?
     
  38. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    I don't directly support mobile/touch, but as you said uGui should make the process very easy. Most likely it's just a matter of enabling a component in the eventsystem.
     
    MD_Reptile likes this.
  39. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,663
    Thanks for sharing, I like the transitions, looks very fluid.
     
    Eric2241 likes this.
  40. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Thanks!
     
  41. Kellyrayj

    Kellyrayj

    Joined:
    Aug 29, 2011
    Posts:
    933
    Thanks Eric! This looks great.
     
  42. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Thanks! If you have a Github account, staring the repo greatly helps out!
     
  43. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    The package has been resubmitted to the Asset Store for approval.
     
  44. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    The package has now been accepted! Download it here: http://u3d.as/qLB. The asset store version is always the most stable version of the pause menu, and is perfect if you need a stable menu in your next build.
     
    PhoenixRising1 and EliasMasche like this.
  45. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    I'm in the middle of implementing the setting saving feature through Unity's JSONUtlity. The saving works fine, but trying to read the file causes this error : "argumentException: Cannot deserialize JSON to new instances of type ...". Does anyone (maybe the Unity people) know a way around this?
     
  46. big_3

    big_3

    Joined:
    Apr 20, 2016
    Posts:
    86
    Hi,

    thanks for this great asset!

    Just a quick question:
    How can I show the pause menu from code? I have a "pause" button in the game and want to show your pause menu when the user presses the button.

    Thanks
    Jus
     
  47. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    If you're using the uGui then it's really simple. In fact, all you need to do is add a method and copy and paste the code from the update method that controls the panels.

    If you need more than this then I'll be happy to write up a code snippet in a few hours.
     
  48. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    @big_3

    This is the code you'll need to make it work with uGUI just copy and paste it into the pause manager script. Remember to assign the onclick() to the method in the pause manager script.
    Code (csharp):
    1.  
    2. public void openPause(){
    3.                 uiEventSystem.SetSelectedGameObject(defualtSelectedMain);
    4.                 mainPanel.SetActive(true);
    5.                 vidPanel.SetActive(false);
    6.                 audioPanel.SetActive(false);
    7.                 TitleTexts.SetActive(true);
    8.                 mask.SetActive(true);
    9.                 Time.timeScale = 0;
    10.                 for (int i = 0; i < otherUIElements.Length; i++)
    11.                 {
    12.                     otherUIElements[i].gameObject.SetActive(false);
    13.                 }
    14. }
    15.  
     
  49. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    I've fixed the game settings saving/loading feature on the repo. Check it out there, and if you guys find any bugs open an issue or post it back here as that always helps. Thanks!
     
    PhoenixRising1 likes this.
  50. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    If you're enjoying this asset please consider rating it on the asset store! Thanks!
     
    PhoenixRising1 likes this.