Nick Steyer пре 2 година
родитељ
комит
0df528542d
1 измењених фајлова са 6 додато и 1 уклоњено
  1. 6 1
      Assets/ZED/Examples/Object Detection/Scripts/ZED3DObjectVisualizer.cs

+ 6 - 1
Assets/ZED/Examples/Object Detection/Scripts/ZED3DObjectVisualizer.cs

@@ -24,7 +24,7 @@ public class ZED3DObjectVisualizer : MonoBehaviour
              "If you want to visualize detections from multiple ZEDs at once you will need multiple ZED3DObjectVisualizer commponents in the scene. ")]
              "If you want to visualize detections from multiple ZEDs at once you will need multiple ZED3DObjectVisualizer commponents in the scene. ")]
     IZEDManager ZedManager => zedManagerLazy.Value;
     IZEDManager ZedManager => zedManagerLazy.Value;
 
 
-    readonly Lazy<IZEDManager> zedManagerLazy = new(new LoggingZEDManager(FindObjectOfType<ZEDManager>(), new DetectionFrameLogger()));
+    Lazy<IZEDManager> zedManagerLazy;
 
 
     /// <summary>
     /// <summary>
     /// If true, the ZED Object Detection manual will be started as soon as the ZED is initiated.
     /// If true, the ZED Object Detection manual will be started as soon as the ZED is initiated.
@@ -141,6 +141,11 @@ public class ZED3DObjectVisualizer : MonoBehaviour
     /// </summary>
     /// </summary>
     private int nextColorIndex = 0;
     private int nextColorIndex = 0;
 
 
+    private void Awake()
+    {
+        zedManagerLazy = new(new LoggingZEDManager(FindObjectOfType<ZEDManager>(), new DetectionFrameLogger()));
+    }
+
     // Use this for initialization
     // Use this for initialization
     void Start()
     void Start()
     {
     {