diff --git a/Assets/Scripts/Scenes/Ride/Competiton/CompetitionUIManager.cs b/Assets/Scripts/Scenes/Ride/Competiton/CompetitionUIManager.cs index ae56a091..4420005f 100644 --- a/Assets/Scripts/Scenes/Ride/Competiton/CompetitionUIManager.cs +++ b/Assets/Scripts/Scenes/Ride/Competiton/CompetitionUIManager.cs @@ -49,6 +49,7 @@ namespace Assets.Scenes.Ride.Scripts altitudeGraph.gameObject.SetActive(false); //暂停按钮禁用 pauseButton.interactable = false; + InitGameObject(); } protected override void Update() { @@ -67,7 +68,12 @@ namespace Assets.Scenes.Ride.Scripts //开始骑行-加个5秒钟倒计时 public override void StartRide() { - competitionModel = mainController.cyclingController as CompetitionModel; + + } + + public void InitGameObject() + { + competitionModel = mainController.cyclingController as CompetitionModel; #if UNITY_IOS || UNITY_ANDROID countDownPanel = Instantiate(Resources.Load("UI/Prefab/Match/Mobile/CountDownPanel"), uipanel.transform); diff --git a/Assets/Scripts/Scenes/Ride/Competiton/CountDownFactory.cs b/Assets/Scripts/Scenes/Ride/Competiton/CountDownFactory.cs index 42d1111f..5b471213 100644 --- a/Assets/Scripts/Scenes/Ride/Competiton/CountDownFactory.cs +++ b/Assets/Scripts/Scenes/Ride/Competiton/CountDownFactory.cs @@ -23,13 +23,17 @@ namespace Assets.Scenes.Ride.Scripts CountTimer = transform.Find("Timer").GetComponent(); TimerTitle = transform.Find("ConpetitionTimerTitle").GetComponent(); Timer = transform.Find("ConpetitionTimer").GetComponent(); - competitionModel = cyclingController.cyclingController as CompetitionModel; + } GameObject competitionResultPanel { get; set; } private void Update() { + if (competitionModel == null) + { + competitionModel = cyclingController.cyclingController as CompetitionModel; + } if (competitionModel != null) { var count = competitionModel.StartCountdown();