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 /
avatar image
0
Question by jcgray83 · Oct 01, 2017 at 02:00 AM · onguitouchpadscrollwheel

Limitation of using OnGUI for Touchpad "ScrollWheel"?

Thanks to a few suggestions I've found here I'm using OnGUI() to use the ScrollWheel Event to add a Camera Zoom effect. It works great, as long as I'm not doing anything else.

But if I'm using the keyboard to control my character ("WASD"), then the OnGUI Event is for the keyboard, and doesn't pick up the MouseWheel event from the Touchpad.

Any suggestions on a workaround? I've looked at the Event.PopEvent but there's almost no documentation on how it works or what to do with it, so I'm not sure if I'm just missing a workaround.

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
0
Best Answer

Answer by jcgray83 · Oct 01, 2017 at 04:55 AM

EDIT Ok, the Mouse/Keyboard inputs seem to be a limitation on my laptop. I decided to test outside of Unity and pressing any keys on my keyboard essentially shuts off my Touchpad. There's probably a setting somewhere in Windows or my Touchpad software that's limiting me.

/EDIT

This code runs fine if I do not use any keys on my keyboard. But holding W to have my character run forward makes this stop.

If I'm not touching the keyboard, and "Scroll" with the Touchpad, and while still scrolling I press a keyboard key everything works as it should. The moment I stop touching the Touchpad means I can't scroll until I stop using the keyboard.

And Input.GetAxis("Mouse ScrollWheel") does not work with touchpads, hence the use of OnGUI().

 public void OnGUI()
     {
         if (Event.current.isScrollWheel)
             // do stuff with  Event.current.delta
             cameraController.CameraDolly(Event.current.delta.y / 100);
     }
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 Bunny83 · Oct 01, 2017 at 08:34 AM 1
Share

A lot modern laptops do this artifically to prevent accidental mouse actions with your palms rubbing across the touchpad while typing something.

See this SU question for potential solutions. Though it might depend on your exact hardware and software. You actually find tons of software tools which implement such a palmcheck artifically. $$anonymous$$aybe your OS installation comes with such a tool pre-installed.

avatar image jcgray83 Bunny83 · Oct 01, 2017 at 07:26 PM 0
Share

I finally fixed the issue, partly from your link, and partly from a google search.

One suggestion that was given was in Windows 10, Settings -> Devices -> Touchpad -> Click Delay While Typing. In the newer versions of Win10 that setting has been replaced by Sensitivity. Changing my Sensitivity to "$$anonymous$$ost Sensitive", the highest setting, now allows me to use my mouse and click while typing.

avatar image
0

Answer by Bunny83 · Oct 01, 2017 at 02:13 AM

I don't quite get your second paragraph. OnGUI does process many different events.which includes key, mouse and scrollwheel events. OnGUI is called for each event seperately.

Event.PopEvent shouldn't be used manually as it will permanentally remove an event from the event queue which prevents any other script or system to process this event. It's used by the new UI system internally to get the UI events.

What does your actual code look like?

As an alternative you should be able to use the virtual input axis named "Mouse ScrollWheel" in conjunction with Input.GetAxis. Even the axis is usually defined by default it's possible that you or something else in your project has remove it from the Input manager. So if it doesn't work, check the input manager (Edit --> Project Settings --> Input).

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

69 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

Related Questions

How to get ScrollWheel values using a laptop touchpad? 1 Answer

Touch pad "wheel" problem 0 Answers

Trackpad and Mouse can't fix scroll speed! 1 Answer

OnGUI() not showing anything 2 Answers

Iterating LList in OnGUI(), slow? 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