I am currently working on a solution to make my game look very pixelated, like Doom or Quake. But there is a big problem.
I'm using Unity Personal.
I render my camera to a 1920x1080 texture, then I try to use Texture2D.Resize on it, then render it back to the screen using ScaleMode.StretchToFill.
But the problem is that the texture seems to corrupt when I use Texture2D.Resize on it.
And here is my current code: using UnityEngine; using System.Collections;
public class PixelRenderer : MonoBehaviour {
Texture2D texture;
// Use this for initialization
void Start () {
texture = new Texture2D(256, 256, TextureFormat.ARGB32, false);
}
// Update is called once per frame
void OnPostRender() {
texture = new Texture2D(Screen.width, Screen.height, TextureFormat.ARGB32, false);
texture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
texture.Apply();
texture.Resize(256, 256);
}
void OnGUI() {
GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), texture, ScaleMode.StretchToFill);
}
}
Is there something that I'm missing here? Or am I doing something wrong?