URGENT - Blocking Exception spam from HDRP Decals

Blocking HDRP Issue

We have a blocking error spam of decal error messages, preventing our artists from working.
It is likely related to the 2021 extended Decal features

We tested on a completely new HDRP project with just an empty cube and it keeps error spamming.
This is especially bad as all our artists can’t really work due to this, requiring restarts potentially every minute.

Reproduction:

  • Open new HDRP project
  • Do empty scene
  • Create prefab
  • Spawn Decal projector into prefab
  • Save prefab
  • Open and Quit Prefab 2-3 times
    —> Exception spam starts, persists until Unity restart.

Happens in any 2021 LTS we tested. Urgent fix requested.

A colleague also filed a report.

Push
This is still blocking the entire team from working in prefabs and must be fixed asap

didn’t happen for me, on 2021.2.7f1 + hdrp 12.1.2,

  • new hdrp scene
  • create empty gameobject
  • create prefab from empty gameobject (drag to project panel)
  • open prefab (selected from hierarchy)
  • add GameObject/Rendering/hdrp decal projector
  • in hierarchy: close prefab, open prefab… repeat many times

Try deleting the library folder of your project, then open it up and see if it still happens.

2021.2 is the Tech stream, we are on the LTS, Its quite a big difference

It happens on a completely empty new HDRP template project, and also on all our PCs on the main project

ah ok yes it does happen there.

seems to happen in this new part of code?

Thanks a lot for the feedback and the report. Can you send the case number here by any chance?
FYI, I was able to repro on my side and will push for it to be fixed asap!

Thats nice to hear!

Could you by any chance send us the fixed HDRP package? We all can’t work right now
Any time estimate would also be really helpful

The case is CASE IN-5185

Thanks, I can’t give an estimate to be honest, but since it’s a regression on an LTS, it will get fixed.
I will keep you posted once it gets looked at.

Hello, the fix has been made so considering the time to land the PR and the next published version, it should be available in a couple of weeks

If really critical you can manually modify the HDRP package to fix the issue:
In Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalProjector.cs, change the following function from

         void RegisterDecalVisibilityUpdatePrefabStage(PrefabStage stage = null)
            => SceneView.duringSceneGui += UpdateDecalVisibilityPrefabStage;

to

       void RegisterDecalVisibilityUpdatePrefabStage(PrefabStage stage = null)
        {
            SceneView.duringSceneGui -= UpdateDecalVisibilityPrefabStage;
            SceneView.duringSceneGui += UpdateDecalVisibilityPrefabStage;
        }
2 Likes

Also had this issue, editing the DecalProject.cs as noted fixed the issue for us. Thanks!
Just in case others are searching, here’s some keywords to help seo:
“MissingReferenceException: The object of type ‘DecalProjector’ has been destroyed but you are still trying to access it.”
Unity 2021.3 LTS, prefab error, camera controls not working in prefab mode

Hi,

The problem also exists in 2021.3.4

Open a Prefab that contains decals.
When you first open the prefab, there is a high probability that the prefab will open up correctly the first time. No major errors and the camera is working.
However, close the prefab and reopen. Now you are presented with multiple errors
“MissingReferenceException: The object of type ‘DecalProjector’ has been destroyed but you are still trying to access it.”
and you can no longer move the camera.

I tried following the steps above and unfortunately for us, if we correct the .ui file that the forum mentions as soon as we do anything in the Unity Project our changes to the UI file are lost as Unity automatically downloads the original ui file. This is due to the fact that our ui file is located in the runtime folder and not at the path mentioned above.
Is there a way around this issue?

I tried upgrading Unity to 2021.3.6 (released July 8th), however the bug was still present. This presents a major blocker to my team as many of our prefabs utilize decals.

Yes, it is fixed on our side but hasn’t landed in a public version for now, hopefully for the next 2021.3 one. (Backports always takes a bit more time)
If it’s critical, you can use the few lines of code shared by @adrien-de-tocqueville above .

Hi,

The problem though is that that file is in the runtime folder on our end. So if we change it and switch back to Unity the file automatically gets reverted to what it was originally.

I’ll keep my eyes peeled for the next build.

I Had the same problem… in 2023.
I’m on Unity 2021.3.5f1 LTS.
HDRP 12.1.7

I Used decals in prefab. Quit prefab, re-entre prefab, maybe two or three times, then :

  • the error message spammed the console
  • I can’t move the scene view camera in prefab mode.
  • The gizmo disappeared, event not in prefab mode, even for other gameObjects than prefabs.

These days i’ve encountered some problems like this. I use Unity for years now (since 2015) but it seems not te be as stable as it should be.

But, tanks for the temporary fix.

This is fixed starting from 2021.3.6f1, can you update to a more recent LTS ? unfortunately we cannot fix already published versions