Skip to content

Narwhal Simulator 21: Pause Menu

Hi everyone! Today I made a pause menu for Narwhal Simulator. Let’s get right into it.

This is the pause menu. It has lots of buttons and sliders. It’s not pretty at the moment, but things aren’t really supposed to be pretty in pre-alpha.

From top to bottom, there is:

  1. A resume button. Clicking this closes the pause menu.
  2. An options button. Clicking this will bring up the options menu when it exists. It doesn’t currently.
  3. The master, music, and sound effects volume sliders. These adjust the volume of the game sounds. They would work a lot better if there were actually any game sounds, but whatever. They’ll work when I add some game sounds.
  4. A quit button. Clicking this closes the game. If you’re in the editor, it doesn’t do anything, but at least it tries, OK?

Next I’ll talk about how the sound sliders save. This was actually super easy. Unity has a system called PlayerPrefs specifically designed for saving settings and preferences. It takes 2 lines of code to store a value in the PlayerPrefs, while it takes a lot more to save things normally. This is really useful. 

I plan on adding save files at some point, which will save the player’s position, items, and the world’s state. Unfortunately, I won’t be able to use PlayerPrefs for save files. PlayerPrefs can only store strings, floating point numbers, and integers. It also stores them in places that are hard to find. On Windows, it stores the settings deep in the registry in a format that isn’t really human readable. That’s ok for settings because, unlike for save files, you don’t need to modify them manually, share them with friends, or back them up. I’ll be using a different solution for saving save files.

That’s really all I have for you. I’ll hopefully have a title screen made for you next week. We’re nearly done this release, the only things left to do are to add more menus, make the player able to die, and a few miscellaneous additions and bug fixes. Thanks for reading, see you next week!

Links recap:



Leave a Reply