QRCoder.Unity
QRCoder.Unity copied to clipboard
Add a UIToolkit control for displaying QR codes
This PR adds a custom UIToolkit control, which makes it easy to incorporate a QR code into a UIToolkit-based user interface.
The control is available from the UI Builder:
You can add it and edit its properties - setting a string value, the ECC level, and the pixels-per-module for rendering, directly in the UI Builder editor:
or add it via UXML directly:
...
<QRCoder.Unity.QRCodeDisplay value="https://www.google.com/" ecc-level="M" pixels-per-module="8" style="height: 300px;" />
...
and of course you can manipulate it via code like any other VisualElement:
var qrCode = uiDocument.rootVisualElement.Q<QRCoder.Unity.QRCodeDisplay>("QR_CODE");
qrCode.value = "http://github.com/";
qrCode.visible = true;
Tested in 2022.3.18f1.