Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by darthbator · Apr 14, 2013 at 02:49 AM · inputjoystickpause

Pause button not "caught" by pause script

I am sure I am just missing something extremely obvious here but my pause script doesn't seem to be catching a button press that my other scripts are. For example Here is a script I am using to just monitor controller input independent of the game.

 if (Input.GetButton("Pause")) {
             debugOUT.text += "\r\n" + "Pause: True"; 
         } else {
             debugOUT.text += "\r\n" + "Pause: False";
     }

^ this works just fine. However my pause script doesn't seem to catch the button press at all.

 void Update () {
         if (Input.GetButtonDown("Pause")) {
             Debug.Log("Pause!");
             if (!isPaused) {
                 pauseTXT.gameObject.SetActive(true);
                 Time.timeScale = 0;
                 isPaused = true;    
             } else {
                 pauseTXT.gameObject.SetActive(false);
                 Time.timeScale = 1f;
                 isPaused = false;
             }
         } 
     }

I can't figure out why that second script doesn't seem to work at all. The button is obviously setup correctly in input manager since it can be caught from another script. This one just doesn't seem to catch it....

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image darthbator · Apr 14, 2013 at 08:14 AM 0
Share

So I found that the issue is that Input.GetButtonDown("Pause") does not work but Input.GetButton works but does not function as I would like it to.

Here is how I have the button setup in the input manager

alt text

input.png (10.5 kB)

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by darthbator · Apr 15, 2013 at 04:34 AM

I just wanted to come back and give the correct answer in case this comes up on google for anyone. My issue was having it setup as an axis and not as a button. You can see the error in my screenshot. I actually realized it checking this thread for answers =P

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Negagames · Apr 14, 2013 at 02:51 AM

Suggetion, try moving the whole if statement of "if(!paused)..." out of the GetButtonDown("Pause part"), and in the getbuttondown part put only:

paused = !paused;

p.s. Between the two scripts you used GetButton and GetButtonDown, could that have caused it?

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image darthbator · Apr 14, 2013 at 03:00 AM 0
Share

Yeah I know about the different input grabs I made. That is because I don't want that loop running as long as the button is down but just during the first frame! I'm going to try fooling around with it once I get home! Thanks for the advice!

avatar image darthbator · Apr 14, 2013 at 08:07 AM 0
Share

Oddly using GetButton works however GetButtonDown does not.... Why could this be?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Permanent unintentional Input on Axis 1 Answer

2D rotation around hinge joint with joystick input 0 Answers

Analog stick control 1 Answer

Logitech G27 pedal input 1 Answer

Disable cinemachine free look camera movement when touch detected on mobile joystick 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges