title: How to convert type 'UnityEngine.Color32[ ]' to 'UnityEngine.Sprite'
body: <p>I'm trying to generate a QR Code using ZXing.Net and at first I have the problem where the <code>.Save()</code> is not working because of an error CS1061. So, I scratched that idea then I tried to save <code>.Write()</code> as image then render it in unity but Unity returns an error:</p>
  
  <p><code>Cannot implicitly convert type 'UnityEngine.Color32[]' to 'UnityEngine.Sprite'</code></p>
  
  <p>I tried using the answer from <a href="https://stackoverflow.com/questions/56676894/how-convert-type-unityengine-texture2d-to-unityengine-sprite/56680083#56680083">here</a> where they used <code>Sprite.Create()</code> as a solution but converted a Texture2D instead of a Color32[ ] but I wasn't able to confirm if the code worked for me since the code returns an error that:</p>
  
  <p><code>The type or namespace name 'Image' could not be found</code></p>
  
  <p>As I said, I wasn't able to find out if the code really worked or not. I don't know what caused the <code>namespace</code> error since the script I'm using is under the Image UI.</p>
  
  <p>These are the codes I'm using:</p>
  
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using ZXing;
  using ZXing.QrCode;
  using System.Drawing;
  
  public class SampleScript : MonoBehaviour
  {
  
      public Texture2D myTexture;
      Sprite mySprite;
      Image myImage;
  
      void Main()
      {
          var qrWriter = new BarcodeWriter();
          qrWriter.Format = BarcodeFormat.QR_CODE;
  
          this.gameObject.GetComponent&lt;SpriteRenderer&gt;().sprite = qrWriter.Write("text");
      }
  
      public void FooBar()
      {
          mySprite = Sprite.Create(myTexture, new Rect(0.0f, 0.0f, myTexture.width, myTexture.height), new Vector2(0.5f, 0.5f), 100.0f);
          myImage.sprite = mySprite;
      }
  
      void Start()
      {
          FooBar();
          Main();
      }
  </code></pre>
  
  <p>I still haven't tested this code since the errors must first be resolved before running.</p>