Warning in Editor - You can only call cameraDepthTarget inside the scope of a ScriptableRen

Hi

My console is filling up with this warning since upgrading to 2020.2 and relevanr AR packages etc.

You can only call cameraDepthTarget inside the scope of a ScriptableRenderPass. Otherwise the pipeline camera target texture might have not been created or might have already been disposed.
UnityEngine.GUIUtility: ProcessEvent (int,intptr,bool&)

From the code (in ScriptableRenderer.cs - URP 10.2.2):

        /// <summary>
        /// Returns the camera depth target for this renderer.
        /// It's only valid to call cameraDepthTarget in the scope of <c>ScriptableRenderPass</c>.
        /// <seealso cref="ScriptableRenderPass"/>.
        /// </summary>
        public RenderTargetIdentifier cameraDepthTarget
        {
            get
            {
                if (!m_IsPipelineExecuting)
                {
                    Debug.LogWarning("You can only call cameraDepthTarget inside the scope of a ScriptableRenderPass. Otherwise the pipeline camera target texture might have not been created or might have already been disposed.");
                    // TODO: Ideally we should return an error texture (BuiltinRenderTextureType.None?)
                    // but this might break some existing content, so we return the pipeline texture in the hope it gives a "soft" upgrade to users.
                }

                return m_CameraDepthTarget;
            }
        }

This is the same as Xcode Warning but on Windows (not mac). Iā€™m going to comment out the warning to avoid filling the console but does anyone know if a fix is in the works?

2 Likes

+1 : Hitting this as well.

+1, same config and error. SRP project. AR camera stopped working.

I reported this as a bug and itā€™s being tracked afaik.

1 Like

Were you able to comment out the code in the package? My project seems to object when I try to do that and requires a rebuild/re-import that reverts my change.

Itā€™s hard to de-bug the project with the console full of this message.

+1

Iā€™m seeing XCode throwing this warning on iOS build with unity 2020.2 and AR Foundation 4.0.9 or 4.1.1
All the AR objects, particles or augmented mask are not shown in AR mode (iphone 12)
Android is fine

I wouldnā€™t recommend this, but upgrading to 2021.1.0b1 fixed it, no more warning messages. I made a copy of my project folder before attempting, as itā€™s never been possible to downgrade a project in my experience.

I had some other problems with building in XCode and so it was worth fixing the various things that broke in my upgrade to the beta. Iā€™m using ARFoundation 4.1.1 with URP 11.0.0. I got rid of any preview or experimental packages as well, so had to lose my UI Elements work and just use the standar uGUI.

Can you file a bug with reproducible project so the team can properly track and take a look? If youā€™ve already filed a bug, can you share the case # so I can make sure itā€™s in our queue? Thanks!

looks like Unity 2020.2ā€™s URP 10 is not yet compatible with ARF 4.1.1

Another related report here:

@Duckocide , @jgmakes , @Siyka , @alexanderameye , @Nonym , @mb13admin : Can you share your case # so I can make sure weā€™re properly tracking and our team takes a look? We have not seen any issues with ARF and URP 10 in our test cases so Iā€™d like to get to the bottom of this. Thanks!

Currently getting this error on URP10.2.2, 2020.2.1f1, and ALSO it looks like the depth (or camera Z?) channel isnā€™t clearing? Once an object pops in, it is slowly occluded by the AR background as they write closer Z values and disappear behind them.

Itā€™s one of the weirdest things Iā€™ve seen. I even removed the occlusion manager. Could this be connected to the error? I could post a video.

Hi @mfuad , my issue is exactly the same as @Chopium explained right above
Clearly URP 10.2 is having compatible bug with any version of ARF
I downloaded ARF samples from github and try to run with URP10.2.2, 2020.2.1f1; the issue occurs on iOS

Great, like Iā€™ve mentioned we ask that you file a bug so we can get this tracked properly in our queue.

Same request for you too @Chopium , can you file a bug so this gets properly tracked? Thanks!

Thank you for your help. I have submitted a bug report (Case 1305714, not yet approved for public) In the meantime we are reverting to the standard renderer, which seems to have no issues. Luckily switching between pipelines is smooth at this stage of the project.

https://www.youtube.com/watch?v=ocr5uJJZBlg

This was a small screen recording of what Iā€™m seeing on device. My project is not super standard, but I believe URP + ARFoundation are the cause of the issue.

Hi, sorry, Iā€™ve been out of the forums a bit. My bad. Anyway, you can find the script buried in the packages folder. Interestingly, since commenting out and refreshing the package (i.e. back in), the issue has disappeared. Iā€™m at a loss, but I see some people have raised a bug for proper investigation.

6731350--774805--upload_2021-1-16_13-49-4.png

Thanks! I recently found while tracking down another bug that itā€™s possible to move libraries out of the package manager and put them directly into the Packages folder (same level as the Assets folder) in this post .

In my case (on a mac), the VFX package was located inside the Unity application Builtin folder. Here are the exact steps on a mac:

  • In the Unity Editor, open the Packages folder, right-click (vfx package for me) and Show in Finder.
  • Back in Unity, remove the vfx package using the package manager
  • Quit Unity.
  • Make a copy of the package folder and put it in the Packages folder in your project
  • Now edits will ā€˜stickā€™ since you are working off your own copy of the package

The ā€œYou can only call cameraDepthā€¦ā€ error is gone in 2021.b1+ so I didnā€™t have to do any of this, but if you donā€™t want to upgrade your project, the above steps should work.

Iā€™m getting this bug too, but only in the actual build (showing up in Xcode console)

+1