diff --git a/MagicUI/Behaviours/InteractivityController.cs b/MagicUI/Behaviours/InteractivityController.cs index e9294c4..b865f7e 100644 --- a/MagicUI/Behaviours/InteractivityController.cs +++ b/MagicUI/Behaviours/InteractivityController.cs @@ -11,6 +11,11 @@ internal class InteractivityController : MonoBehaviour private bool hasCachedAlpha = false; private float cachedAlpha; + internal void ForceUpdate() + { + Update(); + } + private void Update() { CanvasGroup grp = GetComponent(); diff --git a/MagicUI/Core/LayoutRoot.cs b/MagicUI/Core/LayoutRoot.cs index 8cd61cb..9216a3e 100644 --- a/MagicUI/Core/LayoutRoot.cs +++ b/MagicUI/Core/LayoutRoot.cs @@ -204,6 +204,14 @@ public IEnumerable GetElements(string name) where T : ArrangableElement return layoutOrchestrator.Find(name); } + /// + /// Forces the interactivity controller to immediately re-evaluate interactivity conditions without needing to wait a frame + /// + public void ForceInteractivityRefresh() + { + interactivityController.ForceUpdate(); + } + /// /// Destroys the layout root and all of its child elements ///