BarCodeScannerBaseBehaviour Class

Inherits: DeviceUserAbstractBehaviour

Description

BarCodeScannerBaseBehaviour is the component for QR code scan.

(until 1.2.1) You can add this component to any object at any time after EasyAR initiallized, and if QR code detected, event BarCodeUpdate will be triggered. A typical usage is like below. You need to keep the object active if you want below function to work.

private void Start()
{
    var behaviour = gameObject.AddComponent<BarCodeScannerBehaviour>();
    behaviour.EnableOnStart = true;
    behaviour.BarCodeUpdate += OnBarCodeUpdate;
}

private void OnBarCodeUpdate(BarCodeScannerBaseBehaviour scanner, string barcode)
{
    Debug.Log("barcode: " + barcode);
}

(Since 1.3.0) On 1.3 and later, use AugmenterBaseBehaviour.TextMessage to get barcode update.

Public Fields

BarCodeScanner BarCodeScanner
bool EnableOnStart (until 1.2.1)

Public Functions

bool StartScan()
bool StopScan()

Public Events

event Action<BarCodeScannerBaseBehaviour, string> BarCodeUpdate (until 1.2.1)

Overwritten MonoBahaviour Functions

protected virtual void Awake() (until 1.2.1)
protected virtual void OnDestroy()
protected virtual void Start()
protected virtual void Update() (until 1.2.1)

BarCodeScanner BarCodeScanner

The BarCodeScanner object. You can reach advanced controls with BarCodeScanner. See BarCodeScanner for more details.

bool EnableOnStart (until 1.2.1)

Whether to enable the scan after the AR scene starts (when IAREventHandler.OnARStart is called). If not enabled, you need to manually attach the BarCodeScanner to a CameraDevice and call StartScan.

bool StartScan()

Starts the scan. See BarCodeScanner.Start for more details.

bool StopScan()

Stops the scan. See BarCodeScanner.Stop for more details.

event Action<BarCodeScannerBaseBehaviour, string> BarCodeUpdate (until 1.2.1)

Event for a barcode update. You can get the barcode string here when a barcode is detected.