Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a UIToolkit control for displaying QR codes #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

richard-fine
Copy link

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:
image

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:

image

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant