void OnDestroy() { _screenRec.StopRecording(); DeleteReplayFile(); _screenRec.OnStopRec -= _replayCam_OnStopRec; foreach (VehicleManager rvm in ReplayerVehicleManagers) { rvm.DestroyVehicle(); } Destroy(CCF); iVehicleManager CM = DrivingPlayManager.Current.PlayerCarManager; Destroy(ReplayCamController); if (ReopenDrivingMenuOnDestroy && CM.goCar != null) { DrivingPlayManager.Current.UnfreezeCars(); CamSelector.Instance.ActiveCam.GetComponentInChildren <Camera>().enabled = true; CamController_Follow_Swing CamFol = CamSelector.Instance.ActiveCam.GetComponent <CamController_Follow_Swing>(); CamFol.target = CM.goCar; CamFol.enabled = true; RaceRecorder.current.State = "Recording"; DrivingPlayManager.Current.UnpauseCars(); DrivingMenuController dmc = _canvas.GetComponent <DrivingMenuController>(); if (dmc == null) { Debug.LogError("dmc is null"); Debug.Break(); } dmc.ShowPanel(true); //Keeps crashing here not any more cos fixed line 44 } }
/// <summary> /// Makes the CamSelector find the two camera scripts and the car. Then selects the settings camtype /// </summary> public void Init() { name = System.DateTime.Now.Millisecond.ToString(); FollowCam = GameObject.Find("FollowCam"); FollowCamCamera = FollowCam.GetComponentInChildren <Camera>(); FollowFlyScript = FollowCam.GetComponent <CamController_Follow_Fly>(); FollowSwingScript = FollowCam.GetComponent <CamController_Follow_Swing>(); FollowSimpleScript = FollowCam.GetComponent <CamController_Follow_Simple>(); FPCam = DrivingPlayManager.Current.PlayerCarManager.goCar.transform.Find("FPCamera").gameObject; SelectCam("StartingLine"); }