mirror of
https://github.com/BotChain-Robots/ui.git
synced 2026-07-08 15:07:22 +02:00
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:
@@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user