void Awake() { if(tachO != null) GameObject.Destroy(tachO); else tachO = this; DontDestroyOnLoad(this); }
// Start is called before the first frame update private void Awake() { InterfaceObject = GameObject.Find("UI"); Engine = GetComponent <EngineModel>(); VehicleRigidBody = GetComponent <Rigidbody>(); Speedometer = InterfaceObject.GetComponent <SpeedometerScript>(); GraphObject = InterfaceObject.transform.Find("Canvas").gameObject.transform.Find("WindowGraph").GetComponent <WindowGraph>(); graph = InterfaceObject.GetComponent <Graph>(); GearField = InterfaceObject.transform.Find("Canvas").gameObject.transform.Find("Gear").GetComponent <Text>(); (s_SpeedType, m_SpeedCoefficient) = GenericFunctions.SpeedTypeConverter(m_SpeedType); }