c# GUI button controls

So I’m trying to convert my tile-based game into a mobile game, and I need to change the controls from keyboard keys to GUI buttons. I have my player moving in 4 directions: up, down, left and right. I need each of these directions to have it’s own buttons. I’ve watched a lot a of videos and look at lots of other answers, but I can’t figure out how to do it. I know that I need to use the OnGUI function, and I’ve tried, but it says that I cant use “&&.”

Here is my current player script for the keyboard, but how would I integrate the OnGUI function into this to have touch controls?

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour 

{
	
	Vector3 pos;                                // For movement
	float speed = 2.0f;   						// Speed of movement
	static bool[] moving;
	
	void Start () {
		moving = new bool[5];
		pos = transform.position;          // Take the initial position
		GetComponent<BoxCollider2D>().enabled = false;
	}
	
	void FixedUpdate () {
		if (gameObject.tag == "Player") {
			moving[4] = !(Vector2.Distance(transform.position, pos) < 0.01f);
		}
		else {
			moving[GetComponent<CollectFruit>().ID] = !(Vector2.Distance(transform.position, pos) < 0.01f);
		}
		bool doneMoving = DoneMoving ();
		if (doneMoving) {
			GetComponent<BoxCollider2D>().enabled = true;
		}
		if(Input.GetKey(KeyCode.A) && doneMoving && transform.position.x > -1.9f) {        // Left
			pos += Vector3.left;
		}
		if(Input.GetKey(KeyCode.D) && doneMoving && transform.position.x < 1.9f) {        // Right
			pos += Vector3.right;
		}
		if(Input.GetKey(KeyCode.W) && doneMoving && transform.position.y < 1.9f) {        // Up
			pos += Vector3.up;
		}
		if(Input.GetKey(KeyCode.S) && doneMoving && transform.position.y > -1.9f) {        // Down
			pos += Vector3.down;
		}
		transform.position = Vector3.MoveTowards(transform.position, pos, Time.deltaTime * speed);    // Move there
	}
	public bool DoneMoving() {
		return !moving[0] && !moving[1] && !moving[2] && !moving[3] && !moving[4];
	}
}

Learn section on the UI tools.

Is your problem texture is not appearing? If so then follow me.
Add the following codes
Note: it does not anything currently then viewing the texture

//put this in Public class
public Texture Buttonup;
public Texture Buttondown;
public Texture Buttonright;
public Texture Buttonleft;
//you cannot change the variable as much as you want as long you change it in GUI.drawtexture

void onGUI () {
   GUI.DrawTexture(new Rect( 5, 5, 50, 50), Buttonup, ScaleMode, ScaleToFit, 1.0F);

   GUI.DrawTexture(new Rect(15, 15, 50, 50), Buttondown, ScaleMode, ScaleToFit, 1.0F);

   GUI.DrawTexture(new Rect(15, 15, 50, 50), Buttonleft, ScaleMode, ScaleToFit, 1.0F);

   GUI.DrawTexture(new Rect(25, 25, 50, 50), Buttonright, ScaleMode, ScaleToFit, 1.0F);
//Please read under the code to know how to use the code
}

First to change size of textures in new Rect(10, 10, SIZE1, SIZE2)
To change position of texture
new Rect(POSTION1, POSTION2, 50, 50)
After new Rect(1, 1, 1, 1) (here comes name of texture change if you change the variables on top of OnGUI

To add a texture first make a picture using Photoshop or other image editing programs or go search ones in google images.
Put it inside your game files and go to unity editor,click on your script and in the inspector select your Images by clicking each one

If you have any other questions ask me

And your welcome

Somrthing like this and position GUIButtons for your needs :

void OnGUI(){
        		if (gameObject.tag == "Player") {
        			moving[4] = !(Vector2.Distance(transform.position, pos) < 0.01f);
        		}
        		else {
        			moving[GetComponent<CollectFruit>().ID] = !(Vector2.Distance(transform.position, pos) < 0.01f);
        		}
        		bool doneMoving = DoneMoving ();
        		if(GUILayout.Button("←") && doneMoving && transform.position.x > -1.9f) {        // Left
        			pos += Vector3.left;
        		}
        		if(GUILayout.Button("→") && doneMoving && transform.position.x < 1.9f) {        // Right
        			pos += Vector3.right;
        		}
        		if(GUILayout.Button("↑") && doneMoving && transform.position.y < 1.9f) {        // Up
        			pos += Vector3.up;
        		}
        		if(GUILayout.Button("↓") && doneMoving && transform.position.y > -1.9f) {        // Down
        			pos += Vector3.down;
        		}
        		transform.position = Vector3.MoveTowards(transform.position, pos, Time.deltaTime * speed);    // Move there
        	}