bool ValidateOverlapControls(Binds[] binds)
        {
            for (int x = 0; x < binds.Length; x++)
            {
                KeyCode[] defindKeys = new KeyCode[binds[x].AllBinds.Length * 3];

                int index = 0;
                for (int y = 0; y < binds[x].AllBinds.Length; y++)
                {
                    for (int z = 0; z < 3; z++)
                    {
                        if (binds[x].AllBinds[y][z + 1] != KeyCode.None && MenuTools.Contains <KeyCode>(defindKeys, binds[x].AllBinds[y][z + 1]))
                        {
                            return(false);
                        }
                        else
                        {
                            defindKeys[index] = binds[x].AllBinds[y][z + 1];
                        }

                        index++;
                    }
                }
            }

            return(true);
        }
        internal void CreateBindsUI(Binds[] binds, InputManager inManger) //Creates Categories
        {
            inputManager = inManger;

            categories = new GameObject[binds.Length];
            RectTransform controlsScrollRt = controlsScroll.GetComponent <RectTransform>();

            conflictPopup.transform.GetChild(0).Find("Cancel").GetComponent <Button>().onClick.AddListener(Cancel);
            conflictPopup.transform.GetChild(0).Find("Switch").GetComponent <Button>().onClick.AddListener(Switch);
            conflictPopupText = conflictPopup.transform.GetChild(0).Find("Text").GetComponent <Text>();

            popupText = bindPopup.transform.GetChild(0).Find("Text").GetComponent <Text>();

            for (int i = 0; i < binds.Length; i++)
            {
                GameObject catH = new GameObject(binds[i].CategoryName + " Category");
                if (i != 0)
                {
                    catH.SetActive(false);
                }

                categories[i] = catH;

                RectTransform catHRt = catH.AddComponent <RectTransform>();
                catHRt.SetParent(controlsScroll.content, false);

                catHRt.anchorMin = Vector2.zero;
                catHRt.anchorMax = Vector2.one;

                catHRt.offsetMin = Vector2.zero;
                catHRt.offsetMax = Vector2.zero;

                GameObject catO = Instantiate(categoryTemplate);

                RectTransform catRt = catO.GetComponent <RectTransform>();
                catRt.name = binds[i].CategoryName;
                catRt.SetParent(controlsScrollRt, false);
                catRt.anchoredPosition = new Vector2(i * (catRt.sizeDelta.x + 10), 0);

                Button catB = catO.GetComponent <Button>();

                float buttonHeight = bindTemplate.GetComponent <RectTransform>().sizeDelta.y;
                float height       = MenuTools.CalcScrollHeight(binds[i].bindsCount, buttonHeight, 10);

                if (i == 0)
                {
                    MenuTools.SetScrollHeight(controlsScroll, height);
                }

                SetCategoryButton(catB, i, height);

                Text catT = catRt.GetComponentInChildren <Text>();
                catT.text = binds[i].CategoryName;

                CreateBind(i, binds[i].AllBinds);
            }
        }
        void InitUI() //Set UI Values And Listeners
        {
            volumeSl.value        = menuSettings_s.volume;
            shadowsD.value        = (int)menuSettings_s.shadows;
            shadowsQualityD.value = (int)menuSettings_s.shadowsQuality;
            antiAliasingD.value   = (int)menuSettings_s.antiAliasing;
            anFilteringD.value    = (int)menuSettings_s.anisotropicFiltering;
            vSyncD.value          = (int)menuSettings_s.vSync;
            realTimeRefTog.isOn   = menuSettings_s.realTimeReflections;
            fullScreenTog.isOn    = menuSettings_s.fullScreen;

            if (menuSettings_s.resolution == MenuSettings.MaxResolution)
            {
                menuSettings_s.resolution = validResolutions.Length - 1;
            }

            resolutionD.ClearOptions();
            for (int i = 0; i < validResolutions.Length; i++)
            {
                resolutionD.options.Add(new Dropdown.OptionData(validResolutions[i].width + " X " + validResolutions[i].height));
            }
            resolutionD.value = menuSettings_s.resolution;
            MenuTools.SetDropDownText(resolutionD);
            resolutionD.onValueChanged.AddListener(SetResolution);

            volumeSl.onValueChanged.AddListener(SetVolume);
            shadowsD.onValueChanged.AddListener(SetShadows);
            shadowsQualityD.onValueChanged.AddListener(SetShadowsQuality);
            antiAliasingD.onValueChanged.AddListener(SetAntiAliasing);
            anFilteringD.onValueChanged.AddListener(SetAnisotropicFiltering);
            vSyncD.onValueChanged.AddListener(SetVSync);
            realTimeRefTog.onValueChanged.AddListener(SetRealTimeReflections);
            fullScreenTog.onValueChanged.AddListener(SetFullScreen);
            exitB.onClick.AddListener(Quit);
            optionsBackB.onClick.AddListener(() => menuSettings_s.Save(settingsSavePath));

            UpdateAllSettings(menuSettings_s);

            if (menuType == Menu.Main)
            {
                newGameB.onClick.AddListener(LoadNewGame);

                if (levels.AutoCreateUI)
                {
                    CreateLevelUI();
                }
            }
            else
            {
                returnToMainB.onClick.AddListener(LoadMainMenu);
                resumeB.onClick.AddListener(Resume);
            }
        }
        void OpenCategory(int index, float height) //Opens A New Bind Category And Sets The Control Scroll Height
        {
            MenuTools.SetScrollHeight(controlsScroll, height);

            for (int i = 0; i < categories.Length; i++)
            {
                if (i == index)
                {
                    categories[i].SetActive(true);
                }
                else
                {
                    categories[i].SetActive(false);
                }
            }
        }
        internal void Load()
        {
            switch (uiType)
            {
            case UI.InputField:     //InputField
                switch (infData)
                {
                case InputFieldData.Int:         //InputField Int
                    iValue = PlayerPrefs.GetInt(name, iValue);
                    break;

                case InputFieldData.Float:         //InputField Float
                    fValue = PlayerPrefs.GetFloat(name, fValue);
                    break;

                case InputFieldData.String:         //InputField String
                    sValue = PlayerPrefs.GetString(name, sValue);
                    break;
                }
                break;

            case UI.Slider:     //Slider
                switch (slData)
                {
                case SliderData.Int:         //Slider Int
                    iValue = PlayerPrefs.GetInt(name, iValue);
                    break;

                case SliderData.Float:         //Slider Float
                    fValue = PlayerPrefs.GetFloat(name, fValue);
                    break;
                }
                break;

            case UI.Toggle:     //Toggle
                bValue = MenuTools.intToBool(PlayerPrefs.GetInt(name, MenuTools.boolToInt(bValue)));
                break;

            case UI.DropDown:     //DropDown
                iValue = PlayerPrefs.GetInt(name, iValue);
                break;
            }

            UpdateUI();
        }
        internal void Save()
        {
            switch (uiType)
            {
            case UI.InputField:     //InputField
                switch (infData)
                {
                case InputFieldData.Int:         //InputField Int
                    PlayerPrefs.SetInt(name, iValue);
                    break;

                case InputFieldData.Float:         //InputField Float
                    PlayerPrefs.SetFloat(name, fValue);
                    break;

                case InputFieldData.String:         //InputField String
                    PlayerPrefs.SetString(name, sValue);
                    break;
                }
                break;

            case UI.Slider:     //Slider
                switch (slData)
                {
                case SliderData.Int:         //Slider Int
                    PlayerPrefs.SetInt(name, iValue);
                    break;

                case SliderData.Float:         //Slider Float
                    PlayerPrefs.SetFloat(name, fValue);
                    break;
                }
                break;

            case UI.Toggle:     //Toggle
                PlayerPrefs.SetInt(name, MenuTools.boolToInt(bValue));
                break;

            case UI.DropDown:     //DropDown
                PlayerPrefs.SetInt(name, iValue);
                break;
            }
        }
        public void CreateAudioUI(AudioManager newAudioManager) //Create UI For The Audio Manager
        {
            audioManager = newAudioManager;

            for (int i = 0; i < AudioManager.AudioChannels.Length; i++)
            {
                GameObject channelO = Instantiate <GameObject>(audioChannelTemplate);

                RectTransform channelRt = channelO.GetComponent <RectTransform>();
                channelRt.SetParent(audioChannelScroll.content, false);
                channelRt.anchoredPosition = new Vector2(0, -i * (channelRt.sizeDelta.y + 10) - 10);

                Slider sl = channelRt.Find("Slider").GetComponent <Slider>();
                AudioManager.AudioChannels[i].SetUI(sl);

                Text text = channelRt.Find("Text").GetComponent <Text>();
                text.text = AudioManager.AudioChannels[i].Name;
            }

            float channelHeight = audioChannelTemplate.GetComponent <RectTransform>().sizeDelta.y;
            float height        = MenuTools.CalcScrollHeight(AudioManager.AudioChannels.Length, channelHeight, 10);

            MenuTools.SetScrollHeight(audioChannelScroll, height);
        }
        void CreateLevelUI()
        {
            SetLevelPreview();

            for (int i = 0; i < levels.LevelsCount; i++)
            {
                GameObject levelO = Instantiate(levelTemplate);

                RectTransform levelRt = levelO.GetComponent <RectTransform>();
                levelRt.SetParent(levelsScroll.content, false);
                levelRt.anchoredPosition = new Vector2(0, -i * (levelRt.sizeDelta.y + 10) - 10);

                Button levelB = levelO.GetComponent <Button>();
                SetLevelButton(levelB, i);

                Text levelT = levelRt.GetComponentInChildren <Text>();
                levelT.text = levels[i].Name;
            }

            float levelHeight = levelTemplate.GetComponent <RectTransform>().sizeDelta.y;
            float height      = MenuTools.CalcScrollHeight(levels.LevelsCount, levelHeight, 10);

            MenuTools.SetScrollHeight(levelsScroll, height);
        }