public void UpdateTheme() { Color c = ThemeManagerBehaviour.GetColor(ThemeElementType.Normal); foreach (var i in GetComponentsInChildren <Image>(true)) { var preserver = i.GetComponent <ThemePreserver>(); if (preserver == null) { i.color = c; } } c = ThemeManagerBehaviour.GetColor(ThemeElementType.Text); foreach (var t in GetComponentsInChildren <Text>(true)) { var preserver = t.GetComponent <ThemePreserver>(); if (preserver == null) { t.color = c; } } foreach (var s in GetComponentsInChildren <Selectable>(true)) { var preserver = s.GetComponent <ThemePreserver>(); if (s.transition != Selectable.Transition.Animation && preserver == null) { s.transition = Selectable.Transition.Animation; s.gameObject.AddComponent <Animator>().runtimeAnimatorController = ThemeManagerBehaviour.currentManager.controller; } } }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { image = animator.GetComponent <Image>(); from = image.color; to = ThemeManagerBehaviour.GetColor(type); progress = 0; }