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
1
Question by Squall009 · Nov 27, 2011 at 03:31 AM · controllerpausegamepad

Xbox controller not responding correctly with timescale set to 0

I'm making a simple pause script by setting timescale to 0 when pressing the start button on an xbox controller. This works just fine...until you try to press the button again to unpause the game and then it doesn't respond till about the tenth time you press it. I changed the input to detect a keyboard input and the same piece of code didn't have that problem so does anyone know exactly what effect timescale has on gamepad inputs. I have heard that it messes up the asix for the thumbsticks but I thought the buttons still worked fine. This is just the simple toggle I'm using. I read somewhere else that it works better to run the pause function in a coroutine but I tried that and it still didn't work so if anyone has any suggestions it would be much appreciated.

 bool Paused = false;
 
 
 void Update()
 {
     //start is set for my controller 
     If(Input.GetKeyDown(KeyCode.P)) || Input.GetButtonDown("Start"))
     {
         if(Paused == true)//once paused start no longer works
         {
             Time.TimeScale = 1f;
             Paused = false;
         }
         else//start works to pause this
         {
             Time.TimeScale = 0f;
             Paused = true;
         }
     }
 }
Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by aldonaletto · Jan 05, 2012 at 11:09 PM

THIS IS AN ANSWER FROM @Vorrax THAT GOT STUCK IN THE MODERATION QUEUE

I have the same problem, (hope you could understand me, because my english isnt very well) but i know why this happend.

The Problem is that Input is a routine that's called on Update(), but timeScale sets the frame per secs for the engine to zero, so Update() isnt called anymore since you set timeScale to a higher number than zero.

Sooo ... the only input you may have is a mouse or cursor ... but I dont know how to handle it with a controller or without mouse.

Maybe someone else could give us a nice answer / solution.

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 BarkShark · Jan 06, 2012 at 11:37 AM

I don't know if it will work but you can try to set the TimeScale to a very small number : 0.000001. I think that would work.

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

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Android multiple gamepad/controller/joystick support? 1 Answer

Is there a way to fire the inspector events from code? 0 Answers

Mayflash Gamecube controller vibration 0 Answers

PS4 controller right analog stick issue 3 Answers

Playstation 2 like controller - how to use it with Unity? 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