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. Dismiss Notice

Pause Button Won't Work?

Discussion in '2D' started by Dogg, Apr 23, 2014.

  1. Dogg

    Dogg

    Joined:
    Mar 5, 2014
    Posts:
    203
    I have a script that I made from a tutorial on Youtube. The problem is, is that when I press the buttons (either Escape or P) the pause menu doesn't appear up and stop the game. So it won't even work. It's supposed to pause when I press either button. How can I fix this? Here's my script: http://pastebin.com/UjCVth6W
     
  2. playmonkey1

    playmonkey1

    Joined:
    Sep 20, 2013
    Posts:
    60
  3. Bivrost

    Bivrost

    Joined:
    Mar 26, 2014
    Posts:
    80
    The Unity API uses the Pascal Case convention for its method and class names. So the name of the method you are trying to call is Update(), not update().

    1st tip of the day: Stick to that convention (at least in your Unity projects) and you will easily avoid those trap doors.
    2nd tip: Do not lowercase the first letter of your class names. It's fugly. Sticking to that code style will most likely lead to more confusion, bugs and syntax errors later on.
     
  4. Dogg

    Dogg

    Joined:
    Mar 5, 2014
    Posts:
    203
    You don't sound obvious, so don't worry. Thanks for your help, I'll use the debugger in the near future.
     
  5. Dogg

    Dogg

    Joined:
    Mar 5, 2014
    Posts:
    203
    Your method worked for me. Thank you and thanks for the tips too. I'll be sure to watch out next time.
     
    Last edited: Apr 24, 2014