Arvtesh / UnityFx.Outline

Screen-space outlines for Unity3d.
MIT License
1.28k stars 90 forks source link

Fix Depth Outlines for URP 13+ #62

Closed CaseyHofland closed 1 year ago

CaseyHofland commented 1 year ago

Fixes #60

Outlines would trigger a CommandBuffer warning (full error below) when "Enable Depth Testing" was enabled, turning the screen black.

For whatever reason, new RenderTargetIdentifier("_CameraDepthTexture") don't work no mo and Unity decided to provide no solid alternative (you could use camData.renderer.cameraDepthTargetHandle but it suffers from incompatibility with MSAA). THE ONLY FIX I could find was hidden in some desolate forum using Reflection, thank god for the community.

Despite my attitude I'm really happy with this fix: this is the best Outline package out there (...right?) and I would hate for it to get abandoned because of Unity pullin' a fast one on us.

CommandBuffer: temporary render texture _CameraDepthTexture not found while executing Outline--1 (SetRenderTarget depth buffer)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

sidenote: the diff is larger than it should be, probably because I updated line endings. Oh well 🤷

CaseyHofland commented 1 year ago

Weird, I don’t have any indentation issues on my system. I assume you’re not talking about the directives aligned on the far left. My understanding is that that’s standard practice.

james-arndt commented 1 year ago

This is still an issue. URP 14.0.8 using Unity 2022.3.6f1. Same exact error seen above when enabling "Enable Depth Testing".