What is AssetDatabase.Contains()?

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.

Googling didn't take you to the documentation for the method? https://docs.unity3d.com/ScriptReference/AssetDatabase.Contains.html

Hi @spiney199 , yes but I'm not using that method anywhere. Not once in all my project files. Hence my confusion

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.

1 Like

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.

4 Likes

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

1 Like

@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?

8996815--1239214--assetDB.PNG

1 Like

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.

1 Like

@AndyBarnard any chance I could send you a build to check out?