- Home /
 
 
               Question by 
               jomasan · Jul 01, 2016 at 07:36 AM · 
                errorrendertextureosxartifacts  
              
 
              Render texture errors on OSX
Hi, I have been using a render texture to capture thumbnails or player progress. The function below works well on Windows but on MAC I get strange artifacts. (Strange signs and characters + the image to be captured).
The same code seems to work better with 512 x 512 images but I'm trying to capture a 2048 x 2048 image, that's where the issue happens. No issues on Windows... Any advice?
This is the code:
   IEnumerator saveHoodPNG() {
         colorOverride = true;
 
         yield return new WaitForEndOfFrame();
         try {
             int hoodID = PlayerPrefs.GetInt("HOOD_ID");
             int worldID = PlayerPrefs.GetInt("WORLD_ID");
             string filePath = Application.dataPath + "/../world" + worldID + "slot" + hoodID + ".png";
 
             thumbCam2.SetActive(true);
             RenderTexture.active = rTex02;
            
             thumbCam2.GetComponent<Camera>().Render();
 
             Texture2D thumb01 = new Texture2D(2048, 2048);
             thumb01.ReadPixels(new Rect(0, 0, 2048, 2048), 0, 0);
             thumb01.Apply();
 
             byte[] bytes = thumb01.EncodeToPNG();
 
             File.WriteAllBytes(filePath, bytes);
 
             byte[] fileData = File.ReadAllBytes(filePath);
             Texture2D tex = new Texture2D(2048, 2048);
             tex.LoadImage(fileData);
             
             thumbCam2.SetActive(false);
 
         } catch {
             Debug.Log("HOOD THUMB ERROR");
         }
 
     }
 
              
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Build Problem (Mac) 1 Answer
StreamingAssets with OSX 3 Answers
Crashing after placing terrain 0 Answers
Render to texture not working on OS X 0 Answers