nlprog / QRCoderUnityLight

A pure C# Open Source QR Code implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

QRCoder for Unity, Lightweight version

Info

QRCoder is a project by Raffael Herrmann that generates QR codes, and is licensed under the MIT license.

There is a Unity version of this library, but it is quite heavy because it uses NuGet and System.Drawing while this is all not necessary to just generate QR codes for use in Unity. This Lightweight version is pure source code you can put into your project to get a Texture2D for any QR code, without adding any libraries.

Installation

Put the QRCoder folder into your project's Assets folder.

Usage

To get a Texture2D for a QR Code to put onto a Material, you only need one line of code:

Texture2D qrTex = QRCodeHelper.GetQRCode("https://hello.world/", 8);

Optional parameters and overloads

There are options for the ECC level, colors, and some others.

PayloadGenerator.cs - Generate QR code payloads

This bit of documentation from the original repository is also a useful read:

Technically QR code is just a visual representation of a text/string. Nevertheless most QR code readers can read "special" QR codes which trigger different actions.

For example: WiFi-QRcodes which, when scanned by smartphone, let the smartphone join an access point automatically.

This "special" QR codes are generated by using special structured payload string, when generating the QR code. The PayloadGenerator.cs class helps you to generate this payload strings. To generate a WiFi payload for example, you need just this one line of code:

PayloadGenerator.WiFi wifiPayload = new PayloadGenerator.WiFi("MyWiFi-SSID", "MyWiFi-Pass", PayloadGenerator.WiFi.Authentication.WPA);

To generate a QR code from this payload, just call the "ToString()"-method.

You can learn more about the payload generator in the QRCoder Wiki.

The PayloadGenerator supports the following types of payloads:

About

A pure C# Open Source QR Code implementation

License:Other


Languages

Language:C# 100.0%