Hi,
I write this question because I didnt see the answer nowhere. Maybe someone here could help me ant the others. The problem is: how to change keyboard PC button (e.g. “R” - means reset the level, “C”-change camera view) to be available on mobile device:
- uses GUI. Button and “void onGUI”
- uses new UI in Unity 4.6+
So I have the script like that:
using UnityEngine;
using System.Collections;
public class CamManager: MonoBehaviour {
private CarCamera carCamera;
public int cameraChangeCount = 0;
[HideInInspector]
public GameObject target;
public MainFixedCam fixedCamScript;
void Awake () {
carCamera = GetComponent<CarCamera>();
orbitScript = GetComponent<CameraOrbit>();
if(mainFixedCamera)
fixedCamScript = mainFixedCamera.GetComponent<MainFixedCam>();
}
void Update () {
if(Input.GetKeyDown(KeyCode.C)){
cameraChangeCount++;
if(cameraChangeCount == 6)
cameraChangeCount = 0;
ChangeCamera();
}
}
public void ChangeCamera(){
carCamera.playerCar = target.transform;
carCamera.distance = dist;
carCamera.height = dist / 3;
And so on…
I need to change "Input.GetKeyDown(KeyCode.C)"to GUI button, but I dont know what is the command?
Anybody could help me / us?