Created
September 7, 2015 11:39
-
-
Save nicloay/b34ea9a4b8675247cf51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using UnityEngine.UI; | |
| public class DisableToggleBG : MonoBehaviour { | |
| Image cr; | |
| void Awake () { | |
| cr = GetComponent<Image>(); | |
| GetComponentInParent<Toggle>().onValueChanged.AddListener((state) => {OnParentToggleChange(state);}); | |
| } | |
| void OnParentToggleChange(bool state){ | |
| cr.enabled = !state; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment