// Update is called once per frame void Update() { TitleButtons titlescript = GetComponent <TitleButtons>(); if (musictog.isOn == false) { PlayerPrefs.SetFloat("musicvolume", volume.value); } if (SFXtog.isOn == false) { PlayerPrefs.SetFloat("SFXvolume", SFXvolume.value); } }
// Use this for initialization void Start() { transform.GetComponent<Canvas>().worldCamera = Camera.main; titleLogosObject = Instantiate(Resources.Load<GameObject>(titleLogosPath)); titleLogosObject.transform.SetParent(transform); titleLogosObject.transform.localPosition = Vector3.zero; titleLogosObject.transform.localScale = Vector3.one; titleButtonsObject = Instantiate(Resources.Load<GameObject>(titleButtonsPath)); titleButtonsObject.transform.SetParent(transform); titleButtonsObject.transform.localPosition = Vector3.zero; titleButtonsObject.transform.localScale = Vector3.one; titleBacksObject = Instantiate(Resources.Load<GameObject>(titleBacksPath)); titleBacksObject.transform.SetParent(transform); titleBacksObject.transform.localPosition = Vector3.zero; titleBacksObject.transform.localScale = Vector3.one; titleButtonsScript = titleButtonsObject.GetComponent<TitleButtons>(); }