using System.Collections; using System.Collections.Generic; using UnityEngine; using ZXing; using ZXing.QrCode; using System.IO; public class BarcodeMaker : MonoBehaviour { private Texture2D _tex; void Start() { var text = "http://hogehoge.org/"; // QR コードの画像の幅と高さ var width = 256; var height = 256; var writer = new BarcodeWriter { Format = BarcodeFormat.QR_CODE, Options = new QrCodeEncodingOptions { Width = width, Height = height } }; var format = TextureFormat.ARGB32; _tex = new Texture2D(width, height, format, false); var colors = writer.Write(text); _tex.SetPixels32(colors); _tex.Apply(); } private void OnGUI(){ GUI.DrawTexture(new Rect(100, 100, 200, 200), _tex, ScaleMode.StretchToFill); } // Update is called once per frame void Update() { } }