how to use gui buttons as input get axis for mobile?

I tried some ways to do it, but they didn’t worked. Here is my scripts (based on the tutorial series car controller kit, by flat tutorial), I started converting them to use in mobile, and I already got to set up the acelerometer, but the touch inputs are still missing.

WheelScript:

enum wheelType { Steer , SteerAndMotor , Motor , JustAWheel}; 
var typeOfWheel : wheelType;	
var handBreakable : boolean = false;	
var invertSteer : boolean = false;	
var wheelTransform : Transform;		
var zeroAc: Vector3;
var curAc: Vector3;
var sensH: float = 10;
var sensV: float = 10;
var smooth: float = 0.5;
var GetAxisH: float = 0;
var GetAxisV: float = 0;
private var speedFactor : float;	
private var wheelCollider : WheelCollider;		
private var carScript : CarControleScript;		
private var mySidewayFriction : float;	
private var myForwardFriction : float;	
private var slipSidewayFriction : float;	
private var slipForwardFriction : float;	
private var axisH: float = 0;
private var axisV: float = 0;

function ResetAxes(){
    zeroAc = Input.acceleration;
    curAc = Vector3.zero;
    }

function Start () {
wheelCollider = gameObject.GetComponent(WheelCollider);
carScript = transform.root.gameObject.GetComponent("CarControleScript");
SetValues();
ResetAxes();
}


function SetValues(){

myForwardFriction  = wheelCollider.forwardFriction.stiffness;
mySidewayFriction  = wheelCollider.sidewaysFriction.stiffness;
slipForwardFriction = 0.05;
slipSidewayFriction = 0.085;

}


function Update () {
WheelPosition();
ReverseSlip();

wheelTransform.Rotate(wheelCollider.rpm/60*360*Time.deltaTime,0,0);
if (typeOfWheel == wheelType.Steer || typeOfWheel == wheelType.SteerAndMotor)
wheelTransform.localEulerAngles.y = wheelCollider.steerAngle - wheelTransform.localEulerAngles.z;
    
curAc = Vector3.Lerp(curAc, Input.acceleration-zeroAc, Time.deltaTime/smooth);
    GetAxisV = Mathf.Clamp(curAc.y * sensV, -1, 1);
    GetAxisH = Mathf.Clamp(curAc.x * sensH, -1, 1);
}



function FixedUpdate (){
if (typeOfWheel == wheelType.Motor || typeOfWheel == wheelType.SteerAndMotor){
TorqueControle ();
}
if (typeOfWheel == wheelType.Steer || typeOfWheel == wheelType.SteerAndMotor){
SteerControle ();
}
if (handBreakable){
HandBrake();
}
if(!carScript.braked){
Decellaration();
}
}

function InputGetAxis(axis: String): float {
 	var v = Input.GetAxis(axis);
    if (Mathf.Abs(v) > 0.005) return v;
    if (axis=="Horizontal") return axisH;
    if (axis=="Vertical") return axisV;
}
function OnGUI() {

	axisV = axisH = 0;
    if (GUI.RepeatButton( Rect( 10, 435, 100, 35 ), "Forward" ) ) axisV = 1;
	if (GUI.RepeatButton( Rect( 690, 435, 100, 35 ), "Backward" ) ) axisV = -1;
}


function WheelPosition(){
var hit : RaycastHit;
var wheelPos : Vector3;

if (Physics.Raycast(transform.position, -transform.up,hit,wheelCollider.radius+wheelCollider.suspensionDistance) ){
wheelPos = hit.point+transform.up * wheelCollider.radius;
}
else {
wheelPos = transform.position -transform.up* wheelCollider.suspensionDistance; 
}
wheelTransform.position = wheelPos;
}




function Decellaration(){
if (Input.GetButton("Vertical")==false){
wheelCollider.brakeTorque = carScript.decellarationSpeed;
}
else{
wheelCollider.brakeTorque = 0;
}
}



function SteerControle (){
speedFactor = transform.parent.root.rigidbody.velocity.magnitude/carScript.lowestSteerAtSpeed;
var currentSteerAngel = Mathf.Lerp(carScript.lowSpeedSteerAngel,carScript.highSpeedSteerAngel,speedFactor);
if (invertSteer)
currentSteerAngel *= -GetAxisH;
else 
currentSteerAngel *= GetAxisH;
wheelCollider.steerAngle = currentSteerAngel;
}




function TorqueControle (){
if (carScript.currentSpeed < carScript.topSpeed && carScript.currentSpeed > -carScript.maxReverseSpeed && !carScript.braked){
wheelCollider.motorTorque = carScript.maxTorque * Input.GetAxis( "Vertical" );
}
else {
wheelCollider.motorTorque =0;
}
}


function HandBrake(){
if (carScript.braked){
if (carScript.currentSpeed > 1){
SetRearSlip(slipForwardFriction ,slipSidewayFriction); 
}
else if (carScript.currentSpeed < 0){
SetRearSlip(1 ,1); 
}
wheelCollider.brakeTorque = carScript.maxBrakeTorque;
wheelCollider.motorTorque =0;
if (carScript.currentSpeed < 1 && carScript.currentSpeed > -1){
carScript.backLightObject.renderer.material = carScript.idleLightMaterial;
}
else {
carScript.backLightObject.renderer.material = carScript.brakeLightMaterial;
}
}
else {
wheelCollider.brakeTorque = 0;
SetRearSlip(myForwardFriction ,mySidewayFriction); 
}
}


function ReverseSlip(){
if (carScript.currentSpeed <0){
SetFrontSlip(slipForwardFriction ,slipSidewayFriction); 
}
else {
SetFrontSlip(myForwardFriction ,mySidewayFriction);
}
}


function SetRearSlip (currentForwardFriction : float,currentSidewayFriction : float){
if (typeOfWheel == wheelType.Motor || typeOfWheel == wheelType.SteerAndMotor && !carScript.braked){
wheelCollider.forwardFriction.stiffness = currentForwardFriction;
wheelCollider.sidewaysFriction.stiffness = currentSidewayFriction;
}
}
function SetFrontSlip (currentForwardFriction : float,currentSidewayFriction : float){
if (typeOfWheel == wheelType.Steer || typeOfWheel == wheelType.SteerAndMotor && !carScript.braked){
wheelCollider.forwardFriction.stiffness = currentForwardFriction;
wheelCollider.sidewaysFriction.stiffness = currentSidewayFriction;
}
}

Car controle script:

var centerOfMass : Vector3;	//Center of mass
    var dataWheel : WheelCollider;	//Wheel Collider from which you want to calculate the speed
    var lowestSteerAtSpeed : float = 50;	//if lowestSteerAtSpeed < currentSpeed the steer Angle = highSpeedSteerAngel
    var lowSpeedSteerAngel : float = 10;	//This could be a high value
    var highSpeedSteerAngel : float = 1;	//This shouldn't be a high value (recomended for stability of car)
    var decellarationSpeed : float = 30;	//How fast the car will decellarate
    var maxTorque : float  = 50;	//Maximum Torque
    var currentSpeed : float;		//Current Speed of car
    var topSpeed : float = 150;		//Highest speed at which the car can go
    var maxReverseSpeed : float = 50; 	//Highest Reverse speed
    var backLightObject : GameObject;	//Mesh for reverse light
    var idleLightMaterial : Material;	//for idle state
    var brakeLightMaterial : Material; 	//Braked state
    var reverseLightMaterial : Material;	//Reverse state
    @HideInInspector	
    var braked : boolean = false;	//Brake trigger
    var maxBrakeTorque : float = 100; 	//Braking speed
    var speedOMeterDial : Texture2D;	//GUI Texture for dial
    var speedOMeterPointer : Texture2D;		//GUI Texture for needle
    var gearRatio : int[];		//Shift gear at speed
    var spark : GameObject;		//OnCollision Spark
    var collisionSound : GameObject;	//OnCollision Sound
    private var axisH: float = 0;
    private var axisV: float = 0;
    
    function Start () {
    rigidbody.centerOfMass=centerOfMass; //Center of mass , for this the car should be pointing on z axis
    }
    
    function FixedUpdate () {
    HandBrake();
    }
    function Update(){
    BackLight ();
    EngineSound();
    CalculateSpeed();
    
    	 
    }
    
    
    function CalculateSpeed(){
    currentSpeed = 2*22/7*dataWheel.radius*dataWheel.rpm*60/1000;
    currentSpeed = Mathf.Round(currentSpeed);
    }
    
    
    function BackLight (){
    if (currentSpeed > 0 && Input.GetAxis("Vertical")<0&&!braked){
    backLightObject.renderer.material = brakeLightMaterial;
    }
    else if (currentSpeed < 0 && Input.GetAxis("Vertical")>0&&!braked){
    backLightObject.renderer.material = brakeLightMaterial;
    }
    else if (currentSpeed < 0 && Input.GetAxis("Vertical")<0&&!braked){
    backLightObject.renderer.material = reverseLightMaterial;
    }
    else if (!braked){
    backLightObject.renderer.material = idleLightMaterial;
    }
    }
    
    
    function HandBrake(){
    if (Input.GetButton("Jump")){
    braked = true;
    }
    else{
    braked = false;
    }
    }
    
    
    function EngineSound(){
    for (var i = 0; i < gearRatio.length; i++){
    if(gearRatio*> currentSpeed){*

break;
}
}
var gearMinValue : float = 0.00;
var gearMaxValue : float = 0.00;
if (i == 0){
gearMinValue = 0;
}
else {
gearMinValue = gearRatio[i-1];
}
gearMaxValue = gearRatio*;*
var enginePitch : float = ((currentSpeed - gearMinValue)/(gearMaxValue - gearMinValue))+1;
audio.pitch = enginePitch;
}

function InputGetAxis(axis: String): float {

var v = Input.GetAxis(axis);
if (Mathf.Abs(v) > 0.005) return v;
if (axis==“Horizontal”) return axisH;
if (axis==“Vertical”) return axisV;
}

function OnGUI (){
GUI.DrawTexture(Rect(Screen.width - 300,Screen.height - 150,300,150),speedOMeterDial);
var speedFactor : float = currentSpeed / topSpeed;
var rotationAngle : float;
if (currentSpeed >= 0){
rotationAngle = Mathf.Lerp(0,180,speedFactor);
}
else {
rotationAngle = Mathf.Lerp(0,180,-speedFactor);
}
GUIUtility.RotateAroundPivot(rotationAngle,Vector2(Screen.width - 150 ,Screen.height));
GUI.DrawTexture(Rect(Screen.width - 300,Screen.height - 150,300,300),speedOMeterPointer);

axisV = axisH = 0;
if (GUI.RepeatButton( Rect( 10, 435, 100, 35 ), “Forward” ) ) axisV = 1;
* if (GUI.RepeatButton( Rect( 690, 435, 100, 35 ), “Backward” ) ) axisV = -1;*
}

function OnCollisionEnter (other : Collision){

if (other.transform != transform && other.contacts.length != 0){
for (var i = 0; i < other.contacts.length ; i++){
Instantiate(spark,other.contacts*.point,Quaternion.identity);*
var clone : GameObject = Instantiate(collisionSound,other.contacts*.point,Quaternion.identity);*
clone.transform.parent = transform;
}
}
}

function OnDrawGizmos () {
Gizmos.color = Color.white;
Gizmos.DrawWireSphere (transform.position+centerOfMass, 0.1);
}
Does anyone knows how to use the gui buttons as input get axis, or how to convert this script to use natively acelerometer for steering and buttons for acelerate, brake/reverse, and hand brake?

If you are using a GUITexture, then use the method HitTest()

https://docs.unity3d.com/Documentation/ScriptReference/30_search.html?q=hittest

Using this method, you can check whether a particular point is inside a GUI element.

N.B: There are already some posts about this in Answers. You didn’t use the search functionality effectively.