Start a new topic
Solved

Is Screen Capture blocked in Unity Professional?

Is Screen Capture blocked in Unity Professional? 

Obviously it worked, but only a white screen appears.


 

public void OnCapture()
    {

        // 스크린샷
        tempTexture2D = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);
        tempTexture2D.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
        tempTexture2D.Apply();
        Sprite tempSprite = Sprite.Create(tempTexture2D, new Rect(0, 0, Screen.width, Screen.height), new Vector2(Screen.width / 2, Screen.height / 2));

        CaptureImage.SetActive(true);
        CaptureImage.transform.GetChild(0).GetChild(0).GetComponent<Image>().sprite = tempSprite;

        filePath = Path.Combine(Application.temporaryCachePath, "popcorncard.png");
        File.WriteAllBytes(filePath, tempTexture2D.EncodeToPNG());

        CaptureWaterMark.SetActive(false);

        CapturePanel.SetActive(false);
        ShareSavePanel.SetActive(true);

        //ButtonShare();
    }

 


Hi Sang-il,


which Asset are you using for capturing the screen? We don't block anything but you have to take into consideration, that there are two cameras by default.

One camera is rendering the camera frame (called "BackroundCamera" in Professional Edition) and one is rendering the scene (called "WikitudeCamera" in Professional Edition).


Kind regards,
Gökhan

Yes, I was mistaken. The capture works good. It seems that I have fallen into the neurosis that Wikitude is controlling everything. Thank you for reponse. Hope it helps someone, leave the code.  

    public void OnCapture()
    {
        tempTexture2D = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);
        int readPositionY = Screen.height / 2 - Screen.width / 2;
        tempTexture2D.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
        tempTexture2D.Apply();
        Sprite tempSprite = Sprite.Create(tempTexture2D, new Rect(0, readPositionY, Screen.width, Screen.width), new Vector2(0, 0));

        CaptureImage.SetActive(true);
        CaptureImage.transform.GetChild(0).GetChild(0).GetComponent<Image>().sprite = tempSprite;

        filePath = Path.Combine(Application.temporaryCachePath, "image.png");
        File.WriteAllBytes(filePath, tempTexture2D.EncodeToPNG());

        CaptureWaterMark.SetActive(false);

        CapturePanel.SetActive(false);
        ShareSavePanel.SetActive(true);

    }

  

Login or Signup to post a comment