コード例 #1
0
 private void Awake()
 {     //
     if (Instance == null)
     { //
         Instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
コード例 #2
0
    // Start is called before the first frame update
    void Start()
    {
        im = FindObjectOfType <inputManedger>();
        //set sliders from vars in observer script
        mVolSli.value   = ObserverScript.Instance.mvol;
        sfxVolSli.value = ObserverScript.Instance.sfxvol;
        keyBinds        = ObserverScript.Instance.keybinds;

        rebindsBtn[0].GetComponent <Button>().onClick.AddListener(() => { startRebindFor(rebindsBtn[0].name, 0); });
        rebindsBtn[1].GetComponent <Button>().onClick.AddListener(() => { startRebindFor(rebindsBtn[1].name, 1); });
        rebindsBtn[2].GetComponent <Button>().onClick.AddListener(() => { startRebindFor(rebindsBtn[2].name, 2); });
        rebindsBtn[3].GetComponent <Button>().onClick.AddListener(() => { startRebindFor(rebindsBtn[3].name, 3); });
        rebindsBtn[4].GetComponent <Button>().onClick.AddListener(() => { startRebindFor(rebindsBtn[4].name, 4); });
        rebindsBtn[5].GetComponent <Button>().onClick.AddListener(() => { startRebindFor(rebindsBtn[5].name, 5); });
        rebindsBtn[6].GetComponent <Button>().onClick.AddListener(() => { startRebindFor(rebindsBtn[6].name, 6); });
        rebindsBtn[7].GetComponent <Button>().onClick.AddListener(() => { startRebindFor(rebindsBtn[7].name, 7); });
        rebindsBtn[8].GetComponent <Button>().onClick.AddListener(() => { startRebindFor(rebindsBtn[8].name, 8); });
        rebindsBtn[9].GetComponent <Button>().onClick.AddListener(() => { startRebindFor(rebindsBtn[9].name, 9); });
        rebindsBtn[10].GetComponent <Button>().onClick.AddListener(() => { startRebindFor(rebindsBtn[10].name, 10); });
        rebindsBtn[11].GetComponent <Button>().onClick.AddListener(() => { startRebindFor(rebindsBtn[11].name, 11); });
        rebindsBtn[12].GetComponent <Button>().onClick.AddListener(() => { startRebindFor(rebindsBtn[12].name, 12); });
    }