Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 PlatformSix · Jun 15, 2015 at 06:47 AM · uigamepadkeyboard input

How to set up initial delay in UI key input repeat?

I'm making a menu with a set of options that the player navigates through using the keyboard or gamepad. If they hold down, the cursor highlight should cycle through all of the options.

Usually when you have a repeated input, there is a short delay after the initial input before it begins repeating - but Unity UI navigation does not seem to obey any settings from the OS.

I know you can make input repeat faster or slower using "Input Actions Per Second" on the "Standalone Input Module", but how do you implement an initial delay before input repeat?

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

Answer by applemaniac · Jun 15, 2015 at 07:09 AM

You can do this with a Coroutine and a boolean but it's not very clean.

 if(///Your input here && canRepeat)
 {
 //Do what you want
 canRepeat = false;
 StartCoroutine(WaitAndRepeat());
 }
 
 
 ...
 ...
 
 IEnumerator WaitAndRepeat()
 {
 yield return new WaitForSeconds(waitTime);
 canRepeat = true;
 }
Comment
Add comment · Show 3 · 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 PlatformSix · Jun 15, 2015 at 08:47 AM 0
Share

Thanks for the suggestion - I don't quite understand how this connects with UI navigation or the input module.

avatar image applemaniac · Jun 16, 2015 at 08:08 AM 1
Share

it's like a deboucing function. When you interact with your UI, you set a bool to false, and you build your UI to be interactable only if this bool is true.

avatar image TechSupportIncoming1 · Jul 06, 2015 at 09:14 PM 0
Share

In fact it's not clean at all :P YIELD generates lots of GC Allocations. But hey at least you got something for the guy unlike me :)

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

22 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

Related Questions

How can I disable gamepad input, for my UI? 1 Answer

How to make a true virtual keyboard for computer in Unity? 0 Answers

How do you make a method that gets called when a button gets highlighted using the arrow keys? 0 Answers

Only keyboard input works in mac build 1 Answer

UI Navigation with gamepad 7 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