Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to send game view in high resolutions but to let window size of app keep smaller . #13

Open
meganeroppy opened this issue Aug 18, 2020 · 3 comments

Comments

@meganeroppy
Copy link

I'm using UnityCapture to send game view to other app. The resolution sent from Unity app want to be high resolution but window size of Unity app itself need to be smaller.
Is it possible?

@schellingb
Copy link
Owner

If it's an exported, standalone Unity app you probably need to go through a render-to-texture camera to customize the resolution.
If it's running inside the Unity editor, you can set a custom resolution for the play view which will also apply to UnityCapture. First google result explains it: https://answers.unity.com/questions/1193163/change-gameview-ratio-resolution-using-a-custom-in.html

@meganeroppy
Copy link
Author

Thanks for replying.
I would like to solve this on standalone Unity app, so could you give me something like sample sending high-resolution picture (like 1920x1080) from
unity app in smaller size window (like 800x450) with UnityCapture?
I tried to achieve this with some ways, but it seems like that out picture with UnityCapture only available when game view is being displayed, and out picture resolution is always equal to game view.

@schellingb
Copy link
Owner

Can you have a look at the UnityCaptureMultiCam scene in the UnityCaptureSample project?
I think you can easily modify it to be just one camera by changing

    public Camera CaptureCamera1, CaptureCamera2;
...
        CaptureCamera1.targetTexture = new RenderTexture(CaptureResolutionWidth, CaptureResolutionHeight, 24);
        CaptureCamera2.targetTexture = new RenderTexture(CaptureResolutionWidth, CaptureResolutionHeight, 24);
...
        Graphics.DrawTexture(new Rect(    0, h, whalf, -h), CaptureCamera1.targetTexture);
        Graphics.DrawTexture(new Rect(whalf, h, whalf, -h), CaptureCamera2.targetTexture);

to

    public Camera CaptureCamera;
...
        CaptureCamera.targetTexture = new RenderTexture(CaptureResolutionWidth, CaptureResolutionHeight, 24);
...
        Graphics.DrawTexture(new Rect(    0, h, w, -h), CaptureCamera.targetTexture);

Also notice the public int CaptureResolutionWidth = 1920, CaptureResolutionHeight = 1080; which defines the render-to-texture size (sets the window independent size rendered and used by UnityCapture).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants