OnGUI().Slider - Alternative

I’m brazilian and my english is basic.

I’m building a ‘car game’. I have Forward/Backward buttons and a Slider that turns the car, included inner the OnGUI function.

But I’m having a problem with the multitouch. I know that OnGUI does not accept multitouch.

I need an ‘alternative’ for the horizontal slider, that does not use OnGUI function.

If you can give me an ‘button’ alternative, I will be grateful too.

Horizontal slider code:

function OnGUI()
{
		if (Input.touchCount > 0) //if the player touches the screen the slider will be changed
		{
			carmovepark1.HoriGUI = GUI.HorizontalSlider (Rect (Screen.width /25, Screen.height - Screen.height /10, Screen.width /3.8, Screen.height /16), carmovepark1.HoriAll, -30.0, 30.0);
		}
		else // the slider go to '0' value (starting value)
		{
			carmovepark1.HoriGUI = GUI.HorizontalSlider (Rect (Screen.width /25, Screen.height - Screen.height /10, Screen.width /3.8, Screen.height /16), 0, -30.0, 30.0);    
		}    		
}

‘carmovepark1.HoriGUI’ = Var that controls the car rotation. Placed in another script.

Here is a very basic button. Attach it to any game object and drag whatever camera you are using for the interface onto the cam variable. The logic here might give you a start on your slider. BTW did you consider making finger movement anywhere not on a control steer the car rather than a slider? It would be easier to implement and perhaps easier for the user.

using UnityEngine;
using System.Collections;

public class SimpleButton : MonoBehaviour
{
	public Camera cam;
	public Color colorFlash = new Color(0.75f, 0.75f, 0.75f);

	void Update ()
	{
	if (Input.touchCount == 1 && Input.touches[0].phase == TouchPhase.Began)
		{
			Ray ray = cam.ScreenPointToRay(Input.touches[0].position);
			RaycastHit hit;
			if (Physics.Raycast (ray, out hit))
			{
				if (hit.collider.gameObject == gameObject)
				{
					Debug.Log ("Button hit...put code to do domething here");
					StartCoroutine("FlashButton");  // Do something for user feedback
				}
			}
		}
	}
	
	IEnumerator FlashButton()
	{
		Color colorT = renderer.material.color;
		renderer.material.color = colorFlash;
		yield return new WaitForSeconds(0.25f);
		renderer.material.color = colorT;
	}
}