- Home /
Can I use the Input Manager with a specific "area click"?
Hi all, I'm a beginner I would like to use Input Manager with no a specific key but with a specific "area click"... I mean, I would that if there is a click on the right half of the screen the axis increment to 1, else if there is a click on the left half of the screen the axis decrement to -1 Is this possible?
I hope I explained myself
Sorry for my very poor english
Answer by Scribe · Aug 11, 2014 at 01:52 PM
Hi there David!
I'm not sure you can do that with the Input manager however you can do it quite simply through code using Input.mousePosition
if(Input.GetButtonDown("Fire1")){
if(Input.mousePosition.x < Screen.width*0.5){
Debug.Log("left side of the screen clicked!");
}else{
Debug.Log("right side of the screen clicked!");
}
}
Scribe
yes, but in this way I don't have parameters like "gravity" or "sensitivity"... right?
I'm afraid I don't know why this would stop you having gravity or sensitivity. I probably need to see your current code to understand what you mean. This is just a way of checking where you are clicking, it has nothing to do with gravity or sensitivity?
well, gravity and sensitivity are parameters that are setted in the Input manager
anyway, I solved setting in the input manager only positive button with parameter "mouse 0" then in the code I used your code in this way:
if(Input.mousePosition.x < Screen.width*0.5){
this.transform.Translate(new Vector3(-Input.GetAxis("Horizontal") * Time.deltaTime, 0f));
}
else{
this.transform.Translate(new Vector3(Input.GetAxis("Horizontal") * Time.deltaTime, 0f));
}
so with the position i decide if the player must go to the left or to the right
Your answer
![](https://koobas.hobune.stream/wayback/20220613160338im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to detect inputs with New Input System while game is unfocused? 1 Answer
Function GetButton only returning once? 2 Answers
How does sensitivity, in input manager, affect joystick axis? 1 Answer
Player Input Action Map is being deleted when I import prefab to the scene 0 Answers
Click on Arrows to Move Object. 1 Answer