void Update() { if (currentDriver != previousDriver) { previousDriver = currentDriver; UpdateCurrentDriver(currentDriver.ToString()); } }
// Use this for initialization void Awake() { if (driverList.Count <= 0) { LoadAllDrivers(); } UpdateCurrentDriver(currentDriver.ToString()); previousDriver = currentDriver; }
public void UpdateCurrentDriver(string newDriver) { currentDriver = (KartDrivers) Enum.Parse(typeof(KartDrivers), newDriver); foreach (GameObject driver in driverList) { if (!driver.name.ToLower().Contains(newDriver.ToLower())) { driver.SetActive(false); } else { driver.SetActive(true); } } }