So I am trying to utilize the new UI features of 4.6. I am trying to make a 2d game like hill climb racing. I have a main menu that branches off to submenues(Play, bike Select, Track). I would like to know how I could assign a bike to a button basically and then set that bike as the default vehicle in the play scene. That may be hard to understand, Ive been working on this since noon and its now 3 am. On the press of a button I want to set the default bike to what the button says but with a seperate sprite that I have made. Here are the two scripts im using. The first is the button script and the second is the vehicle select. It may seem really messed up but Im too tired to continue.
Script1
void bikeSelect () {
public GameObject currentCar;
Application.LoadLevel("0");
}
Script2
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(CameraControl))]
public class GUIVehicleSelector : MonoBehaviour {
public GameObject Cobra;
public GameObject honda;
public GameObject yami;
public GameObject kawi;
private GameObject currentCar; // The vehicle that is controlled.
public cobra cobra;
void Start(){
/*if(cobra && honda && yami && kawi){
// Disable all the vehicles except the police car.
cobra.audio.enabled = false;
honda.audio.enabled = false;
yami.audio.enabled = false;
honda.GetComponent<SimpleControlVehicle> ().enabled = false;
yami.GetComponent<SimpleControlVehicle> ().enabled = false;
currentCar = kawi;
gameObject.GetComponent<CameraControl>().target = currentCar.transform;
}*/
//cobra.bikeSelect ();
}
void Update(){
// Restart the rotation of the vehicle to the initial position.
if (Input.GetButtonDown ("Jump"))
currentCar.transform.rotation = Quaternion.identity;
}
}