diff --git a/Assets/Extra/Selectable.cs b/Assets/Extra/Selectable.cs index 116395e..33f9d86 100644 --- a/Assets/Extra/Selectable.cs +++ b/Assets/Extra/Selectable.cs @@ -4,6 +4,7 @@ using UnityEngine; //Thanks to : https://sharpcoderblog.com/blog/unity-3d-rts-style-unit-selection +[AddComponentMenu("Speckle/Playground/Selectable"), DisallowMultipleComponent] public class Selectable : MonoBehaviour { @@ -43,6 +44,7 @@ public class Selectable : MonoBehaviour if (SelectionManager.selectables.Contains(this)) { SelectionManager.selectables.Remove(this); + SelectionManager.selectedObjects.Remove(this); } } } \ No newline at end of file diff --git a/Assets/Extra/SelectionManager.cs b/Assets/Extra/SelectionManager.cs index e3340c9..41c0c70 100644 --- a/Assets/Extra/SelectionManager.cs +++ b/Assets/Extra/SelectionManager.cs @@ -4,6 +4,7 @@ using UnityEngine; using UnityEngine.EventSystems; //Thanks to : https://sharpcoderblog.com/blog/unity-3d-rts-style-unit-selection +[AddComponentMenu("Speckle/Playground/Selection Manager"), DisallowMultipleComponent] public class SelectionManager : MonoBehaviour { public Texture topLeftBorder; @@ -32,7 +33,7 @@ public class SelectionManager : MonoBehaviour Vector3 mousePosition1; public static List selectables = new List(); - public static List selectedObjects = new List(); + public static List selectedObjects = new List(); // Update is called once per frame void Update() @@ -66,7 +67,7 @@ public class SelectionManager : MonoBehaviour Bounds viewportBounds = GetViewportBounds(camera, mousePosition1, Input.mousePosition); if (viewportBounds.Contains(camera.WorldToViewportPoint(selectables[i].transform.position))) { - selectedObjects.Add(i); + selectedObjects.Add(selectables[i]); } } } @@ -86,7 +87,7 @@ public class SelectionManager : MonoBehaviour Camera camera = Camera.main; for (int i = 0; i < selectedObjects.Count; i++) { - DrawSelectionIndicator(camera, selectables[selectedObjects[i]].GetObjectBounds()); + DrawSelectionIndicator(camera, selectedObjects[i].GetObjectBounds()); } } } diff --git a/Assets/InteractionLogic.cs b/Assets/InteractionLogic.cs index 266059c..87a517e 100644 --- a/Assets/InteractionLogic.cs +++ b/Assets/InteractionLogic.cs @@ -106,7 +106,6 @@ namespace Speckle.ConnectorUnity InitRemove(); var sender = gameObject.AddComponent(); - //sender.Stream = stream; var btn = gameObject.transform.Find("Btn").GetComponentInChildren