Sunday, March 4, 2018

Utkarsh Dwivedi | Week 8: In the words of Tin, Bugs Galore.


WEEKLY NARRATIVE


This week I worked with Corwin and Joe on adding checkpoints to the save and load scripts, so that player progress could be saved. Once that was done, I started working on what has become a pain now - the pause menu. Last week's timeScale = 0 method of pausing the game works very well with everything, except now if the player pauses the game and then unpauses it by clicking on the "Resume" button in the pause menu, timeScale doesn't reset to 1. If the player presses Escape to unpause, timeScale does reset back to 1. This is because the Escape key input is checked through script, but there was no OnClick event added to the Resume button GameObject.
So the fix to this was supposed to be pretty simple. Write a public function that resets the timeScale to 1 and add an OnClick event on the Resume button to call this function. Then update the Pause Menu prefab so the change persists in all the scenes. Pretty simple. That's what I thought.
For some reason Unity decided to not let me update the prefab, which resulted in not being able to resume the game by clicking on the resume button. I could add an OnClick event and save the scene, and the scene would work fine, but as soon as I hit the "Apply" to prefab button, the event would just lose its reference.
Tin did some research on what this bug was, and apparently it's a Unity bug that we cannot fix ourselves. For now, I have updated every scene's Pause Menu instance to have the OnClick event, but I'll be making a new Pause Menu next week to fix the major problem of not being able to update the prefab. Also, the way the pause menu works right now is very clunky and I would like to take another shot at making a cleaner solution for it.


CONTENT WITH HOURS


  • Save Load Checkpoint Progress (1 hr)
  • Game meeting (1 hr)
  • Pause bug + fixes (2 hr)
  • Playtest QA (0.5 hr)



WORKFLOW EXAMPLES - The weird Unity bug



Before hitting Apply


After hitting Apply



POSITIVE OUTCOMES


  • Saving and loading checkpoints was a fairly easy addition
  • For now, the build will unpause on clicking Resume because I changed every single instance of the pause menu

NEGATIVE OUTCOMES


  • The weird Unity bug that doesn't let people update prefabs.

NEXT TASKS

Work on new programming tasks. Make a new Pause menu.



TOTAL HOURS LOGGED THIS WEEK: 4.5 hours

No comments:

Post a Comment