Hi everyone. I am trying to add a button that will appear after clearing a board in a game. The button is designed to end the level from continuing its process so users don't have to wait for a long time.
----------
Below is some of the code that is calling the button to skip the level. The button name is called: SkipLevelBtn (skip level button).
----------
The skip level button is hidden and then I used a simple show (boolean) to display the button when the target is reached during the game play.
----------
IEnumerator BaseSession () {
DebugPanel.Log("Status (Base)", "Session", "Began.");
while (!limitationRoutineIsOver && !targetRoutineIsOver) {
yield return 0;
}
DebugPanel.Log("Status (Base)", "Session", "Waiting is over.");
// Checking the condition of losing
if (!reachedTheTarget) {
DebugPanel.Log("Status (Base)", "Session", "Session failed. Clearing.");
yield return StartCoroutine(GameCamera.main.HideFieldRoutine());
FieldAssistant.main.RemoveField();
ShowLosePopup();
DebugPanel.Log("Status (Base)", "Session", "Session failed. End.");
yield break;
}
iteraction = false;
DebugPanel.Log("Status (Base)", "Session", "Session completed. Waiting the cutscene.");
yield return new WaitForSeconds(0.2f);
UIAssistant.main.ShowPage("TargetIsReached");
AudioAssistant.Shot("TargetIsReached");
yield return StartCoroutine(Utils.WaitFor(() => CPanel.uiAnimation == 0, 0.4f));
// show skip button
UIAssistant.main.ShowPage("Field");
SkipLevelBtn.gameObject.SetActive (true);
DebugPanel.Log("Status (Base)", "Session", "Session completed. Bonus matching.");
// Conversion of the remaining moves into bombs and activating them
yield return StartCoroutine(BurnLastMovesToPowerups());
yield return StartCoroutine(Utils.WaitFor(CanIWait, 1f));
DebugPanel.Log("Status (Base)", "Session", "Session completed. Clearing.");
// Ending the session, showing win popup
yield return StartCoroutine(GameCamera.main.HideFieldRoutine());
FieldAssistant.main.RemoveField();
StartCoroutine (YouWin ());
//ShowCardPopup();
DebugPanel.Log("Status (Base)", "Session", "Session completed. End.");
}
----------
Could anyone help with this simple issue. The button is not showing properly and the engine keeps saying that the button is not assigned even though it is.
----------
Thanks
↧