private void Start() { switchAnimation = switchAnimation != null ? switchAnimation : GetComponent <SwitchAnimationController>(); if (switchAnimation == null) { Debug.LogError($"{name} is missing an SwitchAnimationController"); } targets = new List <IButtonInteractible>(); if (switchTargets != null) { foreach (var target in switchTargets) { var i = target.GetComponent <IButtonInteractible>(); if (i != null) { targets.Add(i); } } } // Set default state switchAnimation.IsOn = isOn; targets.ForEach(t => t.SetState(isOn)); }
private void Awake() { switchAnimationController = switchAnimationController != null ? switchAnimationController : GetComponent <SwitchAnimationController>(); if (switchAnimationController == null) { Debug.LogError($"{name} is missing an SwitchAnimationController"); } }