- Home /
What is the best way to handle inputs in Unity ?
Hello, I'm new to Unity and currently I'm learning the basics of the editor and scripting. I have learned multiple ways of handling inputs:
OnMouseDown()
-OnMouseDrag()
Input.GetMouseButtonDown()
Using axis in input manager then use
Input.GetAxis()
in script.
So, What is the difference between all that ? Is a certain approach better than others? . Also I have read that there is a package called ( Input System Package) but I haven't used it yet. Is it better than all other methods of handling inputs ?
Thank you.
Answer by Tondoy · Apr 17 at 08:58 PM
Hi, I would recommend to start using Input.GetKeyDown()
, because to my it´s the easiest way of handling basic inputs. The Input.GetAxis()
way is more structured and allows easier support for different input devises. Like providing the abillity to use a gamepad or keyboard and mouse. The "Input System Package" is basicly the new version of the other systems. It´s more clear and offers more opportunities.
So to close things up i would say start using Input.GetKeyDown()
and if you´re more used to Unity you should give the "new Input system" a look.
Your answer
Follow this Question
Related Questions
Unbinding in game settings 1 Answer
Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers
How to rotate with mouse scroll wheel and new input system? 1 Answer
How to assign the right inputs to the right clone? 1 Answer
How to get a key hold to do something which is stored in a variable as KeyCode ? 1 Answer