Example #1
0
    void Start()
    {
        if (!GetComponent <ConfigHandler>() && !GetComponent <UICustomOptions>())
        {
            Debug.LogError("Input Error: Missing ConfigHandler or UICustomOptions script in " + gameObject.name);
            return;
        }

        if (!controlsHelper)
        {
            Debug.LogError("Input Error: ControlsHelper field cannot be null!");
            return;
        }

        for (int i = 0; i < controlsHelper.InputsList.Count; i++)
        {
            controlsHelper.InputsList[i].InputButton.GetComponent <Button>().onClick.AddListener(delegate { RebindSelected(); });
        }

        if (!configHandler.Error)
        {
            Deserialize();
        }
        else
        {
            configHandler.CreateSection("Input");
            UseDefault();
        }

        LoadInputsToList();
    }