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 mattfabius · Apr 17, 2018 at 03:57 AM · inputbugscene-switchingscrolling

Scroll input carrying over to next scene

I'm using Input.GetAxis("Mouse ScrollWheel") for a mechanic of zooming in and out in my game. In one scene, zooming all the way out loads a new scene. The problem is this scrolling carries over into the next scene. To be specific, scrolling loads a new scene and then even if you stop scrolling while the next scene is loading, the scrolling (and therefore zooming) continues at the start of the next scene. I've tried using Input.ResetInputAxes() before and after loading the next scene and at the beginning of the next scene, but none of this prevents the input from carrying over.

Right now, my solution is hacky. I have a boolean that simply prevents input from being taken for the first couple seconds of the next scene, but this is a little annoying for the player so I would like to avoid it if possible. Does anyone have any ideas of how to solve this problem or what may be going wrong?

Thank you!

Comment
Add comment · Show 4
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 Lylek · Apr 17, 2018 at 04:45 AM 0
Share

It may help to see some code. What conditions need to be met in order for the scene to load? I assume they are reset before the new scene is loaded? x] You say even if you stop scrolling it continues, so maybe you need to make sure the player is providing the input?: if(Input.GetAxis("$$anonymous$$ouse ScrollWheel") != 0) { //scroll }

avatar image mattfabius Lylek · Apr 17, 2018 at 10:22 PM 0
Share

The code for zoo$$anonymous$$g varies by scene, so my code isn't super relevant. Input.GetAxis ("$$anonymous$$ouse ScrollWheel") should return 0f when the player is not scrolling, so it's very strange that it is not doing so.

 //Scene 1:
             float size = $$anonymous$$athf.Clamp((text.rectTransform.localScale.y + (Input.GetAxis ("$$anonymous$$ouse ScrollWheel")/12.5f)), 0f, startSize);
             text.rectTransform.localScale = new Vector3 (size, size, size);
     
             if (text.rectTransform.localScale.y < 0.01f) {
                 Input.ResetInputAxes ();
                 text.gameObject.SetActive (false);
                 Scene$$anonymous$$anager.LoadScene ("$$anonymous$$ain");
             }
 
 //Scene 2:
             float fov = cam.fieldOfView;
             fov -= Input.GetAxis("$$anonymous$$ouse ScrollWheel") * sensitivity;
             fov = $$anonymous$$athf.Clamp (fov, $$anonymous$$FOV, maxFOV);
             cam.fieldOfView = fov;



avatar image Serinx mattfabius · Apr 17, 2018 at 11:08 PM 0
Share

does it work if you call Input.ResetInputAxes (); when the scene loads, rather than before loading the next scene? It's possible the inputs are still being registered after the LoadScene call

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

94 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

Related Questions

Infuriating bug: Android build occasionally dropping touch input. 0 Answers

Android: Touch Input Timeout Issue 1 Answer

PS5 Dualsense triggers register as all buttons 0 Answers

rotate with alt doesnt work 15 Answers

Issues with mouse input when locking the cursor 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