- Home /
Rendering at a smaller resolution?
I'm working on a version of my game to display on an older arcade monitor running at 240p, which is half 480p on both dimensions. However, I cannot seem to get Unity to use anything lower then 480p, even when trying to manually set the resolution in a script after setting up my video card to scale to 240p. Has anyone figured out a way to do this? Anyway, that's not my major issue right now; it's resolution scaling.
If I can't get it to run at 240p, I'd like to be able to upscale a 240p render texture and display it at whichever resolution the game is running at. I was able to get this working in the editor, but when I try to run it in a build, everything is just black. While running fraps, the fps counter draws over itself like the whole thing isn't refreshing or something. Anyone have any ideas? Here is my code that works in the editor:
#pragma strict
var renderSizeX : int = 320;
var renderSizeY : int = 240;
var renderTex : RenderTexture;
function Start () {
renderTex = RenderTexture(renderSizeX,renderSizeY,24,RenderTextureFormat.Default);
renderTex.filterMode=FilterMode.Point;
renderTex.Create();
camera.targetTexture=renderTex;
}
function Update () {
}
function OnGUI() {
if(renderTex){
GUI.BeginGroup (Rect (0, 0, Screen.width,Screen.height));
GUI.DrawTexture(Rect(0,0,Screen.width,Screen.height),renderTex);
GUI.EndGroup ();
}
}
Answer by Ante · Mar 28, 2013 at 05:54 PM
To answer my own question, it seems that the stand alone behaves differently, only rendering either to the render texture or to the screen while the editor renders to both. To fix this, I put all of my GUI elements on another layer, created a new camera, and set the culling mask to not show those GUI elements. GUI.DrawTexture still displayed the render texture on the new camera. If it draws it on a specific layer, my guess would be that it draws on the layer of the object it's attached to.
Your answer
Follow this Question
Related Questions
Render Texture strange noise error 1 Answer
Camera Render to texture not showing alpha in build, but does in editor playmode 3 Answers
How do I take a screenshot from a headless server build? 0 Answers
Stop Camera Size and GUI Position Displaying Differently on Different Resolutions 1 Answer
Render to Texture player's path 0 Answers