title: Run heavy processes smoothly
body: <p>This method works fine in the unity editor but in android build the game crashes. I am sure that it's because the process is to heavy for the mobile device.</p>
  <pre><code>public Camera _camera = null;
  
  private void Start()
  {
      TestMethod(Screen.height, Screen.width);
  }
  
  private void TestMethod(int width, int height)
  {
      RenderTexture renderer = new RenderTexture(width, height, 24);
      renderer.antiAliasing = 8;
      _camera.targetTexture = renderer;
      RenderTexture.active = renderer;
      Rect rect = new Rect(0, 0, renderer.width, renderer.height);
      Texture2D texture = new Texture2D(renderer.width, renderer.height, TextureFormat.RGB24, false);
      _camera.Render();
      texture.ReadPixels(rect, 0, 0);
      texture.Apply();
      _camera.targetTexture = null;
      RenderTexture.active = null;
      Destroy(renderer);
  }
  </code></pre>
  <p>So I decided to run the process on another thread but I get errors that says I can not run certain thing on other threads:</p>
  <blockquote>
  <p>get_activeColorSpace can only be called from the main thread</p>
  </blockquote>
  <pre><code>private void TestMethod(int width, int height)
  {
      var task = Task.Run(() =&gt;
      {
          RenderTexture renderer = new RenderTexture(width, height, 24);
          renderer.antiAliasing = 8;
          _camera.targetTexture = renderer;
          RenderTexture.active = renderer;
          Rect rect = new Rect(0, 0, renderer.width, renderer.height);
          Texture2D texture = new Texture2D(renderer.width, renderer.height, TextureFormat.RGB24, false);
          _camera.Render();
          texture.ReadPixels(rect, 0, 0);
          texture.Apply();
          _camera.targetTexture = null;
          RenderTexture.active = null;
          Destroy(renderer);
          return texture;
      });
      // Do whatever with task.Result
  }
  </code></pre>
  <p>I would really appreciate it if someone could provide me with a method that could run the process without crashing the game. It doesn't have to be threading as long as it gets the job done.</p>