Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

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

Discussion in 'AR' started by Duckocide, Dec 27, 2020.

Thread Status:
Not open for further replies.
  1. Duckocide

    Duckocide

    Joined:
    Aug 30, 2014
    Posts:
    28
    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):

    Code (CSharp):
    1.  
    2.         /// <summary>
    3.         /// Returns the camera depth target for this renderer.
    4.         /// It's only valid to call cameraDepthTarget in the scope of <c>ScriptableRenderPass</c>.
    5.         /// <seealso cref="ScriptableRenderPass"/>.
    6.         /// </summary>
    7.         public RenderTargetIdentifier cameraDepthTarget
    8.         {
    9.             get
    10.             {
    11.                 if (!m_IsPipelineExecuting)
    12.                 {
    13.                     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.");
    14.                     // TODO: Ideally we should return an error texture (BuiltinRenderTextureType.None?)
    15.                     // but this might break some existing content, so we return the pipeline texture in the hope it gives a "soft" upgrade to users.
    16.                 }
    17.  
    18.                 return m_CameraDepthTarget;
    19.             }
    20.         }
    21.  
    This is the same as https://forum.unity.com/threads/xcode-warning.1024825/ 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?
     
    ROBYER1 and jgmakes like this.
  2. jgmakes

    jgmakes

    Joined:
    Jan 10, 2019
    Posts:
    75
    +1 : Hitting this as well.
     
  3. Siyka

    Siyka

    Joined:
    Aug 17, 2014
    Posts:
    10
    +1, same config and error. SRP project. AR camera stopped working.
     
  4. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    1,381
    I reported this as a bug and it's being tracked afaik.
     
    Siyka likes this.
  5. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    539
    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.
     
  6. Nonym

    Nonym

    Joined:
    Oct 18, 2014
    Posts:
    49
  7. mb13admin

    mb13admin

    Joined:
    May 28, 2017
    Posts:
    21
    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
     
  8. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    539
    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.
     
  9. mfuad

    mfuad

    Unity Technologies

    Joined:
    Jun 12, 2018
    Posts:
    332
    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!
     
  10. mb13admin

    mb13admin

    Joined:
    May 28, 2017
    Posts:
    21
    looks like Unity 2020.2's URP 10 is not yet compatible with ARF 4.1.1
     
  11. mb13admin

    mb13admin

    Joined:
    May 28, 2017
    Posts:
    21
  12. mfuad

    mfuad

    Unity Technologies

    Joined:
    Jun 12, 2018
    Posts:
    332
    @Duckocide, @jgmakes, @Dobri, @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!
     
  13. Chopium

    Chopium

    Joined:
    Jun 15, 2015
    Posts:
    19
    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.
     
  14. mb13admin

    mb13admin

    Joined:
    May 28, 2017
    Posts:
    21
    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
     
  15. mfuad

    mfuad

    Unity Technologies

    Joined:
    Jun 12, 2018
    Posts:
    332
    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!
     
  16. Chopium

    Chopium

    Joined:
    Jun 15, 2015
    Posts:
    19
    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.

    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.
     
  17. Duckocide

    Duckocide

    Joined:
    Aug 30, 2014
    Posts:
    28
    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.

    upload_2021-1-16_13-49-4.png
     
  18. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    539
    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:
    1. In the Unity Editor, open the Packages folder, right-click (vfx package for me) and Show in Finder.
    2. Back in Unity, remove the vfx package using the package manager
    3. Quit Unity.
    4. Make a copy of the package folder and put it in the Packages folder in your project
    5. 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.
     
  19. edwon

    edwon

    Joined:
    Apr 24, 2011
    Posts:
    260
    I'm getting this bug too, but only in the actual build (showing up in Xcode console)
     
  20. peterpunk

    peterpunk

    Joined:
    Nov 25, 2012
    Posts:
    11
  21. Gangsta-Geek

    Gangsta-Geek

    Joined:
    Aug 11, 2012
    Posts:
    32
    I had this issue in the last 12hours. My solution was to downgrade to Unity 2019.4.18f1 and to URP 7.5.2 because I need to keep on work on AR features. It sucks but it works for now.
     
  22. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,768
  23. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    1,381
    This was indeed the same case ID I was given back in december. Hopefully it'll be fixed soon!

    For me the error is just showing up in android logcat and afaik doesn't prevent me from doing anything I want. Do you know if the issue has actual implications on features?
     
  24. ignacioambrois

    ignacioambrois

    Joined:
    Feb 6, 2017
    Posts:
    7
    Is there any workaround for iOS? It seems like it's preventing the camera feed from working at all
     
    ROBYER1, RF_SparkLab and Siyka like this.
  25. puppetisto

    puppetisto

    Joined:
    Jun 21, 2020
    Posts:
    14
    Has anyone been able to resolve this?
     
  26. Duckocide

    Duckocide

    Joined:
    Aug 30, 2014
    Posts:
    28
    Great (not). Just upgraded to latest AR Foundation and AR Foundation Remote (Asset) and the issue is back :(

    upload_2021-2-5_17-46-8.png
     
  27. marnsmith

    marnsmith

    Joined:
    Feb 7, 2013
    Posts:
    28
    Same. I'm sort of getting around it by blitting the camera frames to a render texture and drawing myself. A real fix is still needed.

    An active ARCameraBackground seems to cause some other render pass hooks to be invoked, despite the URP configuration. This no longer happens when you copy that script into your project and use it instead!

    Here's a gist I'm using with legacy renderer support stripped and a separate blit script. You can disable the blur option.

    https://gist.github.com/marns/0df3335b10b8f2065ae29f18de2c04dd
     
  28. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    803
    I just encountered this warning message as well.

    Unity 2020.3f1 LTS
    AR Foundation 4.0.12
    ARKit XR Plugin 4.0.12
    Universal RP 10.3.2

    Unfortunately the hack by @marnsmith does not work for me.

    [EDIT] Issue persists with:
    AR Foundation 4.1.5
    ARKit XR Plugin 4.1.5
     
    Last edited: Mar 22, 2021
    KrisKay and ROBYER1 like this.
  29. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,601
    Confirmed. Updating my project to 2021.1.0b10 Beta solved the issue for me.
     
  30. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    1,381
    Last edited: Mar 26, 2021
    unnanego and ROBYER1 like this.
  31. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,431
    Really doing my head in when debugging a build in Xcode too
     
    DuckStock and unnanego like this.
  32. KrisKay

    KrisKay

    Joined:
    Jan 29, 2021
    Posts:
    3
     
  33. robertslr

    robertslr

    Joined:
    Sep 24, 2015
    Posts:
    11
    Same here.
    Unity 2020.3 0f1 LTS
    AR Foundation 4.0.12
    ARKit XR Plugin 4.0.12
    Universal RP 10.3.2

    Could anyone confirm I can safely ignore the Warning Log?
    At the moment it doesn't look to affect anything on the app.

    Anyone have a way to comment the Log without disable all of them?

    Thanks.
     
  34. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    3,453
    No issues here but I do have the error
     
  35. devkj

    devkj

    Joined:
    Mar 15, 2019
    Posts:
    1
    Still experiencing this warning.
    Unity 2020.3.4f1 LTS
    AR Foundation 4.0.12
     
    ROBYER1 likes this.
  36. shibi2017

    shibi2017

    Joined:
    Jan 18, 2018
    Posts:
    150
    When I doing this:

    blitPass.Setup(renderer.cameraDepthTargetHandle);

    inside AddRenderPasses()

    I got the same warning. And playmode alwyas stop when I enter game mode
     
  37. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    525
Thread Status:
Not open for further replies.