BYTE Devlog #1.1: White RenderTexture in RenderFeature when creating Windows build

When creating the Windows build for my BYTE demo, I ran into a very sticky issue where, for some reason, the windows build displayed this pink screen instead of the correctly dithered scene from the Unity Editor.

As you can see in the image, the UI does correctly display on top of the pink screen, which pretty clearly cued me into the fact that this had to do with either my shaders or the RenderFeature that used a Blit to apply the shaders to the camera’s RenderTexture. This was confirmed by the fact that the screen was not totally white, but pink, which was the color my Threshold shader was supposed to apply to the dithered texture.

Initially I thought that this might have something to do with my dithering shader, which was supposed to apply just before the threshold shader, but testing didn’t confirm that. The two approaches to testing I used were to try other RenderFeatures and shaders–which I knew worked–in the BYTE project, but the builds seemed to have the same results (the screen would be white, pink, or grey depending on what combinations of shaders I used). I also tried my dithering and threshold shaders on a different project and had no issues creating a build of that project.

This indicated that, for some reason, the Unity project was not correctly passing the camera’s RenderTexture to the RenderFeature and my shaders were just running on a white screen. This was, safe to say, a big issue, made even worse by the fact that I could not find a single person on the entire internet that had encountered this issue before. I came very close to making my first Unity forum post asking for help before I remembered something: this project was a built-in render pipeline project that I upgraded to the Universal Render Pipeline after creating the project.

This was, and this is not an exaggeration, the only seemingly significant difference between the BYTE project and the other project that I tested my shaders on, so I created a new Unity project in URP and copied all my assets over to it. It worked perfectly. There were no issues.

It looks like there must have been some discrepancy or error in the Unity project when upgrading it to URP that didn’t fully transfer the project to the new pipeline, which caused issues when creating a build specifically. I have no idea what the issue was or if there was an alternate solution, but making a new project was the only way that I could find to resolve it.

PSA: IF YOU WANT TO USE RENDERFEATURES IN URP, DO NOT MAKE THE PROJECT IN THE BUILT-IN PIPELINE AND UPGRADE IT

,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: