Пример #1
0
    private Canvas panelCanvas;         // Canvas the panel is a child of

    // Activate the panel, play sound effect, pause the game
    public void PanelAndPause(bool activate)
    {
        pausePanel.SetActive(activate);
        Timekeeper.PauseGame(activate);
        SoundPlayer.Instance.PlaySoundEffect(quickClip);

        // If panel is activating, make the sorting order of the canvas arbitrarily large
        if (activate)
        {
            panelCanvas.sortingOrder = 10;
        }
        // Otherwise, make the sorting order zero
        else
        {
            panelCanvas.sortingOrder = 0;
        }
    }