simple 2D controller for touch screens (arrows left/right/up/down)

Hi,

I´m a newbie in unity. I want in my game (for mobile phones) use simple 2D controller for my gameObject. I don´t want nothing complicated only at the bottom left corner of the screen add left, right, up, down arrows. That´s it.

When user click on it, the character should move to the right direction.

In my project I have for now this:

		if (Input.GetKey(KeyCode.RightArrow))
			dir = Vector2.right;
		else if (Input.GetKey(KeyCode.DownArrow))
			dir = -Vector2.up;    // '-up' means 'down'
		else if (Input.GetKey(KeyCode.LeftArrow))
			dir = -Vector2.right; // '-right' means 'left'
		else if (Input.GetKey(KeyCode.UpArrow))
			dir = Vector2.up;

I tried to google some tutorial or hint but I didn´t find anything useful. I don´t need complicated joystick with different directions.

Try reading the docs: