Divide the screen to a right and left button

I want a press on the right and left side of my android device to do things.

void Update () {

	if (Input.GetKey("left"))
	{
		transform.Rotate(0, 0, 45);
	}
	if (Input.GetKey("right"))
	{
		transform.Rotate(0, 0, -45);
	} } }

With this code i can press the right and left button on my keyboard, and what I want to happend, happends. Please help me.

if(Input.touchCount > 0){
Vector3 position = Input.touches[0].position;
float rotation = (position.x < (Screen.width / 2)) ? 45f : -45f;
transform.Rotate(0,0,rotation);
}