using System.IO; using UnityEngine; using QRCoder; public static class QrMaker { // Возвращает Texture2D для UI/материалов public static Texture2D MakeTexture(string text, int pixelsPerModule = 1, bool drawQuietZones = true) { using var gen = new QRCodeGenerator(); using var data = gen.CreateQrCode(text, QRCodeGenerator.ECCLevel.M); var png = new PngByteQRCode(data); // Генерим PNG-байты без System.Drawing byte[] bytes = png.GetGraphic(pixelsPerModule); var tex = new Texture2D(2, 2, TextureFormat.RGBA32, false); tex.LoadImage(bytes); // раскодирует PNG → RGBA tex.Apply(false, false); return tex; } }