Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

Unity setup request

A topic by Fede Makes Games created Mar 30, 2016 Views: 2,645 Replies: 16
Viewing posts 1 to 12

Hi everyone!

I wonder if someone can lead me to tutorials/resources about how to manage to get a 64X64 resolution in Unity (and maybe have the viewport adapt to various screen by getting pixel bigger).

The first thing I've thought is to map the entire game on a 64x64 render texture, but maybe there are other (cleaner?) ways.

Dunno if I'm going to use Unity, though. I was intrigued by Defold engine also.


I thought the same thing regarding the render texture and it seems like it is unfortunately really the only way. In addition, the project settings don't allow for perfectly square resolutions which means any projects will be letterboxed at best. I am considering not participating because I was going to just use unity since it is what i know, and it just doesn't allow 64x64 strictly.


I got it working with these:

Submitted (1 edit)

Several solutions (and several problems):

  1. There is a very simple image effect script by @Miguelito that pixelates the camera image, HOWEVER, it doesn't make the format square. To make it square you either have to enforce a special resolution through Screen.SetResolution, HOWEVER, not all platforms (GPUs I think) support non-standard resolutions in full screen and will just crash when you use the method (windowed is fine). Or, you can create some letterboxing squares that match up with 64 pixel width
  2. Using a camera that writes to a 64x64 resolution render texture, then that outputs to the main camera. HOWEVER, in that case, unity assumes the camera is 64 pixels tall and will scale image effects or shadow mapping for example

What I will do: I'll go with 1. with letterboxing, and if windowed then I'll force the square resolution. I'll use it primarily cause I intend to use real time shadows in 3d and I need them to be sharp and crisp

(1 edit) (+1)

Just use Unity's RenderTexture. Take a look at the example in the manual (near the bottom of the page).

You can quickly build on that process by using a Quad (GameObject -> 3D Object -> Quad) instead of a cube.

  • Create a new RenderTexture asset
    • Set the resolution to 64x64
    • Set AA to none
    • Set Filter Mode to Point
  • Assign the RenderTexture to the "Target Texture" field of the Main Camera
  • Create a Quad (GameObject -> 3D Object -> Quad)
    • Turn off Cast & Receive shadows on the Mesh Renderer
  • Drag the RenderTexture asset onto the Quad to use the RT as its material
    • Change the shader on the Quad to use "Unlit/Texture"
  • Create a new Camera
    • Set this to Orthographic
    • Set Size to 0.5 (assuming that the Quad is of unit size)
  • Align the Camera to the Quad
  • Create a new Layer
  • Assign that new layer to the Quad
  • Set the new camera to only render that layer
  • Set the Main Camera to exclude rendering that layer

Tada! You got yourself a low res 64x64 setup in Unity. =D

Essentially the "Main Camera" captures all the gameplay, and the other camera will just render the Quad and nothing else. The only problem now is building a player with a 1:1 aspect resolution. I have not found an answer to that yet other than what nothke has said about Screen.SetResolution.

Thanks A LOT! I'll be using this method to my game. Now I'll prototype until I have something fun to play.

I've just used this method and works like a charm. Now I have "only" to set up the fixed resolution. Thanks

(1 edit)

While I was digging around looking for similar setups, I came across PixelCamera2D. The approach is somewhat similar, though it is already packaged as a prefab.

Regarding the fixed resolution, I tried out Packer's Auto Resolution script and it works great. I just made a few tweaks. In the Update method, I also call the AutoScreenSize if Screen.width != Screen.height, and I have an IsPowerOfTwo method instead of checking for each height value. You can take a look at the code here. The code ensures pixel perfection; it changes the resolution to the next power of 2 smaller than the chosen resolution. It works for both windowed and fullscreen modes.

(2 edits)

Regarding publishing, the only workaround I see so far is to target WebGL. You can use arbitrary resolutions for this.

EDIT: If deploying as Windows/Mac/Linux binary, you could just put some artwork on the extra spaces (this can be achieved as some background quad larger than the render quad). One could also use this area for on-screen controls if deploying to mobile devices. Perhaps making it look like the play area is inside an arcade cabinet?


Hey Guys,
So far everyone's kind of come up with ways to do things in Unity but never really touch on the power of two resolution issue, so I'm posting my solution.

Auto Resolution: Download
So what the script does is if the screen height resolution isn't the power of two it loops down until a power of two number is reached, this works in windowed mode on the fly but I haven't made it update for full screen yet. But if you choose a higher than 1024 and full screen in the launcher it works fine. The idea being it always enforces the pixels on screen to be perfectly square at all resolutions.

Auto Resolution Note: You'll need something that deals with the 1:1 Aspect Ratio, I use Aspect Ratio Enforcer and it works perfectly. Also if you have a 1080p screen and it only appears at 512 when you maximize its because the window intersects with your task bar at the bottom of the screen.

So I've spent my whole day working out how to set this all up before even reading anything here. Every way seems to come with positives and negatives (Pixels and movement), the render texture technique seems good at first then you move around and pixels will disappear and reappear regardless of settings so that kind of killed that for me. I have a new way I'm going to setup that involves snapping the camera and the player visuals to the nearest int but have the actual player gameobject move around freely using Rigidbody2D, this allows the use of Physics built into Unity and not having to reinvent the wheel while retaining a solid pixel perfect feel. I'll could try to release my scripts if people are interested.


I was mucking around with this last night. I found if you set the project settings for the Player (web and app) to 64 x 64 size then all was good. Only problem is when building for the web, you get this large unity logo (which does disappear) but you also get the "Development Build" text that doesn't disappear and covers 1/3 of a screen real estate in a 64 x 64 window. I'm thinking of making the web one 64 x 96 to accomodate for the text but just use the 64 x 64 area. Either that or I abandon using the web player.

i did the same method as feefyefowfum. Although in addtion I set up A UGUI Canvas with another camera. Created a "rawImage UI Element" which I set to 256x256. (while the RenderTexture was set to 64x64 of course) Now you can have any size player. and the RenderTexture will always be displayed in the center of the screen at a size of 256x256 regardless of window size and/or ratio.


One thing I noticed is that you can't mouse click any of the UI if you are rendering the UI to the rendertexture. I might try to fix this later but for now I'll stick to selection with keys.

(1 edit)

I have not tried this yet, but theoretically, if you are using pixel fonts and assuming that the camera that shows the render texture is orthographic, you can just "align" the pixels of the font to the render texture. Going with that, this can also work with any artwork. Doing so, the UI is in front of the render texture (assuming that the Canvas is set to "Screen Space - Camera")

EDIT: the other idea is if you are rendering your UI to the render texture as well, you could add trigger colliders to the render texture, but that can be tedious to setup especially if you have animated UI. A possible solution is to have static "hotspots" on the render texture, and just swap the UI that fits into those hotspots.

Submitted (2 edits) (+1)

Retro Pixel


Try this.

Submitted (1 edit)

I tried going the rendertexture route, but there were issues with getting and setting pixels from transparent textures. In the end I went back to doing regular GameObjects with low res sprites, and only round off the rigidbodies' positions and applying them to sprites. The same rounding happens on the camera.

If your resolution is off, you can get artifacting between sprites, but you can just set the window size using Screen.SetResolution(resX * multiplier, resY * multiplier). Any whole multiplication of 64 works just fine.

The benfit of doing it all this way, is that all your regular Unity skills still apply, unlike with drawing to a texture, which has its own pitfalls.