Out of curiosity, why do you need to pause the music when you pause the game?
Progress report B
We're about halfway through the month and I'm about halfway through development! Everything is going well and the last couple of days I've concentrated on all the boring stuff that comes with game development, namely;
Once the game starts players first get to see a splashscreen displaying my logo. I'm not entirely happy with the option Unity provides by default so I created my own script that'll scale logos better and offer nicer fading. Also; you can skip the logos. Please add this to your game now if you haven't.
The menu is basic and offers the bare minimum for games. Since the game is only playable using a mouse I didn't have to bother adding keyboard or gamepad controls. The first button (levels) is highlighted because it's the most important.
In the corners you'll find my logo plus a link to my Twitter so people can quickly find me if they like to see more, or keep their game up-to-date.
The settings menu has three tabs; visuals, audio and gameplay. Visuals include options for setting the resolution, screen mode (windowed) and overall quality of the game. Again, the bare minimum (...and often missing in indie games).
The audio tab allows users to finetune the volume of sound effects and music. In the gameplay tab users can toggle helpful notes on and off, the game also features a short tutorial.
During the game users can pause the game. You'd think this would be easy to add but it has some snags. First you'd want to pause gameplay by setting the time of your game to 0 (Time.timeScale = 0), then you'd want to temporarily pause the audio from playing (AudioListener.pause = true). Finally you'd want to make sure that you can't pause or unpause when i.e. the level has been completed and the result screen is showing.
After a level has been completed I keep track of the time it took the player and whether a bonus objective has been completed. This gets written to a data class which is then saved as a JSON file in the users save directory. The reason I'm not using PlayerPrefs is because this offers more flexibility, is easier to edit if players want to make changes to their save and honestly it's just quicker to code the JSON file writing (using JsonUtility) and using a data class than it is to use PlayerPrefs in a lot of cases.
Stay tuned for a new development blog
next week soon!