/// <summary> /// Finds the first available ZEDToOpenCVRetriever in the scene, or creates a new one (Singleton). /// Note that it's better to have the component in the Scene ahead of time, especially if using multiple ZED cameras. /// </summary> /// <returns></returns> public static ZEDToOpenCVRetriever GetInstance() { if (!_instance) { GameObject go = new GameObject("ZED to OpenCV Retriever"); _instance = go.AddComponent <ZEDToOpenCVRetriever>(); } return(_instance); }
void Start() { //We'll listen for updates from a ZEDToOpenCVRetriever, which will call an event whenever it has a new image from the ZED. if (!imageRetriever) { imageRetriever = ZEDToOpenCVRetriever.GetInstance(); } imageRetriever.OnImageUpdated_LeftGrayscale += ImageUpdated; }
private void Awake() { _instance = this; //Singleton implementation. }