void UpdateButtonEnabled(SceneTransition.Transition transitionState, Button[] allButtons)
    {
        if (allButtons != null)
        {
            // Check whether we want to enable buttons or not
            if (transitionState == SceneTransition.Transition.NotTransitioning)
            {
                // Grab the game settings
                GameSettings settings = Singleton.Get <GameSettings>();

                // If not transitioning, enable buttons
                for (index = 0; index < allButtons.Length; ++index)
                {
                    // Make the button interactable if it's unlocked
                    allButtons[index].interactable = (index < settings.NumLevelsUnlocked);
                }

                // Enable the quit button
                quitButton.interactable = true;
            }
            else
            {
                // If so, disable all buttons
                for (index = 0; index < allButtons.Length; ++index)
                {
                    allButtons[index].interactable = false;
                }

                // Disable the quit button
                quitButton.interactable = true;
            }
        }
    }
 void Update()
 {
     // Check if we need to update the button states
     if (transition.State != lastTransitionState)
     {
         UpdateButtonEnabled(transition.State == SceneTransition.Transition.NotTransitioning);
         lastTransitionState = transition.State;
     }
 }
    void Update()
    {
        // Grab the settings
        SceneTransition transition = Singleton.Get <SceneTransition>();

        // Check if we need to update the button states
        if (transition.State != lastTransitionState)
        {
            UpdateButtonEnabled(transition.State, allLevelButtons);
            lastTransitionState = transition.State;
        }
    }
    void Awake()
    {
        // Grab the parent of the level button
        Transform buttonParent = levelButton.transform.parent;

        // Grab the settings
        SceneTransition transition = Singleton.Get <SceneTransition>();

        // Setup all buttons
        allLevelButtons = SetupLevelButtons(buttonParent, transition);

        // Grab the game settings
        GameSettings settings = Singleton.Get <GameSettings>();

        // Check if we should remove the quit button (you can't quite out of a webplayer)
        if (settings.IsWebplayer == true)
        {
            // Grab the level gird's minimum range
            Vector2 minAnchor = levelLayoutGroup.CachedRectTransform.anchorMin;
            Vector2 minOffset = levelLayoutGroup.CachedRectTransform.offsetMin;

            // Grab quite button's minimum range
            RectTransform buttonTransform = quitButton.GetComponent <RectTransform>();
            minAnchor.y = buttonTransform.anchorMin.y;
            minOffset.y = buttonTransform.offsetMin.y;

            // Expand the level gird to encompass
            levelLayoutGroup.CachedRectTransform.anchorMin = minAnchor;
            levelLayoutGroup.CachedRectTransform.offsetMin = minOffset;

            // Disable the quit button entirely
            quitButton.gameObject.SetActive(false);
        }

        // Check if we need to update the button states
        if (transition.State != SceneTransition.Transition.NotTransitioning)
        {
            UpdateButtonEnabled(transition.State, allLevelButtons);
            lastTransitionState = transition.State;
        }
    }
    void Start()
    {
        // Grab the settings
        transition = Singleton.Get <SceneTransition>();

        // Grab the game settings
        settings = Singleton.Get <GameSettings>();

        // Setup all buttons
        allLevelButtons = SetupLevelButtons(levelButton.transform.parent);

        // Check if we should remove the quit button (you can't quite out of a webplayer)
        if (settings.IsWebplayer == true)
        {
            /*
             * // Grab the level gird's minimum range
             * Vector2 minAnchor = levelLayoutGroup.CachedRectTransform.anchorMin;
             * Vector2 minOffset = levelLayoutGroup.CachedRectTransform.offsetMin;
             *
             * // Grab quite button's minimum range
             * RectTransform buttonTransform = quitButton.GetComponent<RectTransform>();
             * minAnchor.y = buttonTransform.anchorMin.y;
             * minOffset.y = buttonTransform.offsetMin.y;
             *
             * // Expand the level gird to encompass
             * levelLayoutGroup.CachedRectTransform.anchorMin = minAnchor;
             * levelLayoutGroup.CachedRectTransform.offsetMin = minOffset;
             */
            // Disable the quit button entirely
            quitButton.gameObject.SetActive(false);
        }

        // Update button states
        UpdateButtonEnabled(transition.State == SceneTransition.Transition.NotTransitioning);
        lastTransitionState = transition.State;
    }