Пример #1
0
    private void Awake()
    {
        Instance = this;
        GameObject tutorialCanvasObject = Instantiate(tutorialCanvas);

        for (int i = 0; i < tutorialCanvasObject.transform.childCount - 1; i++)
        {
            Button buttonCurrent = tutorialCanvasObject.transform.GetChild(i).GetComponent <Button>();
            Button buttonNext    = tutorialCanvasObject.transform.GetChild(i + 1).GetComponent <Button>();
            buttonCurrent.onClick.AddListener(() =>
            {
                Debug.Log("Click");
                buttonCurrent.gameObject.SetActive(false);
                buttonNext.gameObject.SetActive(true);
            });
        }

        Button button = tutorialCanvasObject.transform.GetChild(tutorialCanvasObject.transform.childCount - 1).GetComponent <Button>();

        button.onClick.AddListener(() =>
        {
            button.gameObject.SetActive(false);
            isTutorialFinished = true;
        });
    }
Пример #2
0
 private void OnDestroy()
 {
     Instance = null;
 }