Question by
Inze · Oct 20, 2015 at 12:04 PM ·
gameobjectbuttonbutton trigger events
Button included as gameObject, perform action when pressed
I'm currently working on a thing for Android and therefore I need to use buttons in order to move the users. Currently I have this script:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class Movement : MonoBehaviour {
public GameObject GasPedal;
public GameObject BrakePedal;
public GameObject LeftArrow;
public GameObject RightArrow;
int movementSpeed = 200;
void Update () {
if (--------) {
transform.Translate (Vector3.forward * Time.deltaTime * (movementSpeed / 100));
}
}
}
I'm not sure if I'm doing this right, but I need to have something on --------
that says something like GameObject GasPedal is being pressed
Thanks in forward
Comment
Your answer
Follow this Question
Related Questions
Matching Button ID to information displayed on GameObject 0 Answers
Button make object teleport (simple) 1 Answer
Unity Broken Buttons 0 Answers
UI Button click event through script 1 Answer