Merge branch 'BTS-139' into 'main'

Fix: Add SelectedModule static property to ModuleSelector

See merge request capstone-group2/ui!7
This commit is contained in:
Leo Qu
2026-02-22 20:09:01 -05:00

View File

@@ -16,8 +16,12 @@ public class ModuleSelector : MonoBehaviour
[System.NonSerialized] [System.NonSerialized]
public ModuleBase prevModule; public ModuleBase prevModule;
private static ModuleSelector _instance;
public static ModuleBase SelectedModule => _instance != null ? _instance.prevModule : null;
void Awake() void Awake()
{ {
_instance = this;
// Auto-resolve the IK view root if not wired in the inspector. // Auto-resolve the IK view root if not wired in the inspector.
if (inverseKinematicsViewRoot == null) if (inverseKinematicsViewRoot == null)
{ {
@@ -81,4 +85,9 @@ public class ModuleSelector : MonoBehaviour
if (EventSystem.current != null) if (EventSystem.current != null)
EventSystem.current.SetSelectedGameObject(null); EventSystem.current.SetSelectedGameObject(null);
} }
void OnDestroy()
{
if (_instance == this) _instance = null;
}
} }