Hello!
When you use Input.GetMouseButtonDown(0), what’s a way where you could tell where it is pressed? Pretty much I want it to be like where if you click the left of the screen, it does a function, and if you press the right, another function. Please help me a little with coding, epically with raycasting since I am pretty new to this stuff.
Thanks!
If that’s all that you want no raycast is needed just check if Input.mousePosition.x
is greater than Screen.width * 0.5f
, if so your click was on the right side of the screen, otherwise left.
private void Update()
{
if(Input.GetMouseButtonDown(0))
{
if(Input.mousePosition.x > Screen.width * 0.5f)
{
//Right side.
}
else
{
//Left side.
}
}
}