protected void Start()
        {
            if (_qrCodesManager == null)
            {
                _qrCodesManager                = QRCodesManager.FindOrCreateQRCodesManager(gameObject);
                _qrCodesManager.QRCodeAdded   += QRCodeAdded;
                _qrCodesManager.QRCodeRemoved += QRCodeRemoved;
                _qrCodesManager.QRCodeUpdated += QRCodeUpdated;
            }

            StartTracking();
        }
        protected async void OnEnable()
        {
            if (_qrCodesManager == null)
            {
                _qrCodesManager = QRCodesManager.FindOrCreateQRCodesManager(gameObject);
                _qrCodesManager.DebugLogging = debugLogging;
            }

            if (_qrCodesManager != null)
            {
                _qrCodesManager.QRCodeAdded   += QRCodeAdded;
                _qrCodesManager.QRCodeRemoved += QRCodeRemoved;
                _qrCodesManager.QRCodeUpdated += QRCodeUpdated;
                await StartTrackingAsync();
            }
        }
예제 #3
0
        public static QRCodesManager FindOrCreateQRCodesManager(GameObject gameObject)
        {
            if (qrCodesManager != null)
            {
                return(qrCodesManager);
            }

            qrCodesManager = FindObjectOfType <QRCodesManager>();
            if (qrCodesManager != null)
            {
                return(qrCodesManager);
            }

            Debug.Log("QRCodesManager created in scene");
            qrCodesManager = gameObject.AddComponent <QRCodesManager>();
            return(qrCodesManager);
        }