Hey,

I am just a begginer and I need to help with a script when touching left or right side of the screen by mouse. The code bellow is just example, does not work.

	void Update () {

		if (Input.GetMouseButtonDown (0) > Screen.width / 2) {
				Debug.Log ("RightTouch");
		}
	
		if (Input.GetMouseButtonDown (0) < Screen.width / 2) {
				Debug.Log ("LeftTouch");
		}
	}

I wrote a script similar to that when trying to port one of my games to Android. While the clicks registered properly, the functions that I wrote to execute after the click didn’t work properly.

While there’s probably a better solution out there, what I just did was create 2 buttons that spanned the entire left and right of the screen, deleted their text objects, changed the images to a completely transparent image (UIMask will work) then wrote this script to get the buttons to work.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ScriptName : MonoBehaviour
{
    public void LeftMove()
    {
        // Write function here
    }
    public void RightMove()
    {
        // Write function here
    }
}

As I said, there’s probably a better solution but this has worked for me so far.

Have you read the docs? If you have then you’ll know that the functions you are using return bool and not a pixel position. Maybe you want to use Input.mousePosition.