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 Skeeall13 · Aug 12, 2021 at 06:18 PM · gameplay

Input sometimes delayed

I exported my game to EXE and WEBGL, and sometimes when you press a key, the input doesn't trigger. It makes the game harder and it's just overall very annoying.

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 Eno-Khaon · Aug 13, 2021 at 07:12 PM 0
Share

In what ways are you checking for and utilizing Input? You mentioned in another comment that you're using Input.GetKey(), but what function is that called from? When the key's checked, how is it being used? Is it a complete lack of behavior or is it inconsistent behavior (e.g. an impact that could vary based on framerate differences between editor and build)?

2 Replies

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

Answer by GamerLordMat · Aug 13, 2021 at 08:04 PM

Are you testing in Update or FixedUpdate?

Comment
Add comment · Show 11 · 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 Skeeall13 · Aug 13, 2021 at 09:09 PM 0
Share

FixedUpdate

avatar image Eno-Khaon Skeeall13 · Aug 13, 2021 at 09:16 PM 0
Share

For any immediate input tests (GetKeyDown() and GetKeyUp()), this is a bad idea, since those can be missed entirely by asynchronous ti$$anonymous$$gs of Update() and FixedUpdate().

That said, it's still "wrong" to use FixedUpdate() for Input.GetKey() (and similar) as well, so you should move your logic for input into Update() in general.

avatar image Skeeall13 Eno-Khaon · Aug 13, 2021 at 09:22 PM 0
Share

I originally had it in Update() but when it's put in Update() the camera would jitter because the character's movement is based around Rigidbody2D, if I switch it back it's be all jittery again. Is there any way I could put it in Update() without it being Jittery.

Also, Interpolate doesn't work for me

Show more comments
avatar image GamerLordMat Skeeall13 · Aug 14, 2021 at 09:31 AM 0
Share

Also note that Fixed Update goes with a framrate of 50 frames per second; that is pretty slow alone but the operation system has some delay too. But that is not noticeable (I've done some simple experiments with Input delay 50 ms delay is totally fine)

avatar image Invertex GamerLordMat · Aug 16, 2021 at 02:54 AM 0
Share

Also, you can set the fixed update rate (not really accurate to call it a frame rate) in your Edit>ProjectSettings>Time section. So you could make it 60, or even 120 if you wanted (though depending on the demands of your physics interactions, you may not be able to keep that rate consistent)

avatar image
0

Answer by adimac93 · Aug 13, 2021 at 10:02 AM

@Skeeall13 Maybe that can help you: Input values are floats between -1.0 and 0.0 / 1.0 and 0.0. If you are checking for equality there can be a problem. Try using >=, >=.

Comment
Add comment · Show 1 · 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 Skeeall13 · Aug 13, 2021 at 06:30 PM 0
Share

I use

If (Input.GetKey("Z")){ // do something }

So that cant work but thank you for the response

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

126 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

Related Questions

2D Gameplay Tutorial - Main Camera 1 Answer

Lag type issue? 1 Answer

How to make circle circle itself when pressing buttons? 1 Answer

Built game crashes when clicking off game screen at any point 1 Answer

How to check if object are link via other collider 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