Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Scaleable Render Texture Resolution at Runtime(AKA making your game look pixelated)

Pixelated game screens for your retro-esque games are cool! The future is now to make your games look worse! It would be even cooler if the player could choose the resolution while they play, or it changes during gameplay! 


Getting this to work at runtime was a bit of an issue, and I couldn't find any one straight answer online. Hopefully it'll help someone else out. This was done in Unity 2022.3.4f1 (and also working in the 2022.3.62.f2 security patch version). It also assumes you are already using a render texture output from your camera.

The usual disclaimer: I am not a programmer, I am what I optimistically call a ‘functionality coder’.

Step 1: Have the camera output set to your render texture

Step 2: Use this line in whatever script you're using to adjust the pixel resolution. For me, it was just attached to a slider value in the pause menu. x and y is the resolution scale (1, 1, being the size you have set the render texture to in the inspector).


Step 3: In the render texture, make sure Dynamic Scaling is set to true. Any render texture flagged with this setting will be affected by ScalableBufferManager.ResizeBuffers.




--- This was the point where things weren't working as expected. There were no changes to the resolution of the render texture at runtime. Below is what allowed it to work for me ---

Step 4:  Go to Edit -> Project Settings -> Player. Uncheck 'Auto Graphics API for Windows' (or whatever platforms are being used). Add 'Direct3D12' from the dropdown. Drag it so it is the first item in the list.



That's all. 

Support this post

Did you like this post? Tell us

Leave a comment

Log in with your itch.io account to leave a comment.