Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by Cymrodan · Aug 22, 2017 at 09:50 PM · androidandroid buildtime.deltatimetime.timescaletimers

Time responding different when playing on Android Device (the APK, not Anroid Remote)

Strange behaviour I'm encountering at the moment with some counters counting down faster than they should when playing on my Android Device from an APK file.

I have a "slow down time" ability in my endless runner. You can only use this for "foo" duration. To update the players current "foo" amount, I do the current "foo" -= Time.unscaledDeltaTime; This works fine in unity. I used unscaled because I want foo to reduce per second, rather than every 2 seconds (since slow down time sets time.timescale to 0.5f.

When I try this on my installed APK on an android device (other devices have the behaviour too), instead of "foo" being reduced by 1 per second, it seems to be about double that. The game however runs at the same speed (from some testing running unity and phone at same time, the player move through the world at same speed). What's even more odd, is when I jump during slowdown, it makes the "foo" reduce even faster! All my jump is doing is adding velocity to the rigidbody attached to the player until a separate timer (that counts down how long you can jump for) reaches 0. That timer uses deltaTime, as I want the jump duration to be affected by the slow down (otherwise you'd be able to jump less high during slow down mode).

I tried replacing unscaled delta time by Time.UnscaledTime instead, and manually calculating each update cycle the difference between last frames unscaledTime and this frames unscaledTime, but it resulted in the same behaviour when exported to APK and run on an Android device.

Has anyone encountered something and have some advice? This is my first game and I really want to try and get it closer to release but this is causing big playability issues right now for me. Thanks kindly in advance for anyone who reads and contributes.

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

1 Reply

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

Answer by Cymrodan · Aug 26, 2017 at 04:26 PM

Solved myself! it was actually not an android bug. The problem was that I had assigned mouse1 (right click) in my input controls so that on PC i could focus while holding right click. What I wasn't aware of, was mouse1 is triggered by multi-touch on mobile. So essentially in my code when I pressed the focus button - it was running code in the focus button and the code that listened for the "mouse1" input. That caused a few other bugs too for me. But lesson is, mouse1 (right click) will have an effect on mobile controls if they ever use more than one touch on the screen. Hope this helps someone else sometime x

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

185 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image 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

How can I make my Android Library Plugin (.aar) resources folder accessible so that anyone using it can easily modify or include their own drawables resources? 0 Answers

Google Play Game services Resolution Exception with newer Google Repository version 2 Answers

Google play reject for android 64 bit build 2 Answers

does direct SQL connection with Unity work in Android? 0 Answers

Update() function not working on Android. 1 Answer


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