Fix: Add SelectedModule static property to ModuleSelector

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leo Qu
2026-02-22 20:05:50 -05:00
committed by Leo Qu
parent 715c1513c6
commit 9dfa593e7b

View File

@@ -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;
}
}