From 9dfa593e7b5b979550c5f7199221cbd7a95b8c0f Mon Sep 17 00:00:00 2001 From: Leo Qu Date: Sun, 22 Feb 2026 20:05:50 -0500 Subject: [PATCH] Fix: Add SelectedModule static property to ModuleSelector Co-authored-by: Cursor --- Assets/ModuleSelector.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Assets/ModuleSelector.cs b/Assets/ModuleSelector.cs index 5f5a5f0..cac758f 100644 --- a/Assets/ModuleSelector.cs +++ b/Assets/ModuleSelector.cs @@ -16,8 +16,12 @@ public class ModuleSelector : MonoBehaviour [System.NonSerialized] public ModuleBase prevModule; + private static ModuleSelector _instance; + public static ModuleBase SelectedModule => _instance != null ? _instance.prevModule : null; + void Awake() { + _instance = this; // Auto-resolve the IK view root if not wired in the inspector. if (inverseKinematicsViewRoot == null) { @@ -81,4 +85,9 @@ public class ModuleSelector : MonoBehaviour if (EventSystem.current != null) EventSystem.current.SetSelectedGameObject(null); } + + void OnDestroy() + { + if (_instance == this) _instance = null; + } } \ No newline at end of file