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.
  2. Dismiss Notice

Question What is AssetDatabase.Contains()?

Discussion in 'Editor & General Support' started by InfinityGameDev, May 4, 2023.

  1. InfinityGameDev

    InfinityGameDev

    Joined:
    Jun 28, 2016
    Posts:
    47
    I'm using HDRP and I keep getting massive framerate drops. Using Deep profile it says AssetDatabase.Contains() is taking up over 70% of the CPU. I can't find much online about this. Any ideas how to fix this? Thanks.
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,604
  3. InfinityGameDev

    InfinityGameDev

    Joined:
    Jun 28, 2016
    Posts:
    47
    Hi @spiney199 , yes but I'm not using that method anywhere. Not once in all my project files. Hence my confusion
     
  4. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,604
    Have you looked at the call stack to see where it originates from?

    Also note that it's an editor only function and shouldn't be present at run time.
     
    InfinityGameDev likes this.
  5. AndyBarnard

    AndyBarnard

    Unity Technologies

    Joined:
    Nov 12, 2019
    Posts:
    13
    Always remember to profile a build running on target hardware to ensure you're collecting representative performance data :). As @spiney199 correctly said, AssetDatabase is editor-only functionality so it's likely only relevant if you're investigating Editor performance. I presume you were profiling Play Mode for it to show in your capture.
     
  6. InfinityGameDev

    InfinityGameDev

    Joined:
    Jun 28, 2016
    Posts:
    47
    Hi @spiney199 @AndyBarnard , thanks for the help! I'm trying to build my project now to see if I can ignore it (encountering issues there too haha) but I haven't checked the call stack. If it's still giving me issues I'll go back and check.
    Best,
    James
     
    spiney199 likes this.
  7. InfinityGameDev

    InfinityGameDev

    Joined:
    Jun 28, 2016
    Posts:
    47
    @AndyBarnard @spiney199 , here's the callstack (if I'm capturing it correctly). It's made play mode unplayable, even for testing. I can send a video to show you. Anyway, I'm not quite sure how to read this, seeing as it just seems that the HDRP renderer is the issue. Any ideas?
     

    Attached Files:

    halley likes this.
  8. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,802
    Yeah, just saying "run it in a build on your target" isn't enough. Tanking performance like 50-70% CPU in the Editor is just a plain bug.
     
    alexeyzakharov likes this.
  9. InfinityGameDev

    InfinityGameDev

    Joined:
    Jun 28, 2016
    Posts:
    47
    @AndyBarnard any chance I could send you a build to check out?