Universal RP or LWRP reload assemblies each time on play mode

Hey all,

I’ve posted this as a bug here: https://fogbugz.unity3d.com/default.asp?1202878_j8tr84n1unjrtihk

But am hoping that someone else may have found a workaround for this issue.

Initially I tried converting my project to use LWRP, everything will “work” in there however on entering play mode each time it will put this message in the editor log:

Begin MonoManager ReloadAssembly
Symbol file LoadedFromMemory doesn't match image C:\Users\Andrew\Documents\Horse Academy 2020\Library\PackageCache\com.unity.ext.nunit@1.0.0\net35\unity-custom\nunit.framework.dll```

And then take around 5 minutes to finish doing that before entering play mode. With the LWRP / URP packages disabled it enters play mode immediately. Any workaround no matter how hacky would be great for now until the bugs investigated as we're in a bit of limbo right now until I can figure out how to get it sorted.

Reading the notes on 2019.3 - It seems that if I turn on “Enter Play Mode Settings” and make sure that it doesn’t “Reload Domain”, it fixes the issue. There are some plugins in the project (Photon) which has a static constructor though and shall have to come up with a hacky work around for this to make it work.

A further update - On editing any code it will take 5+ minutes to “reload domain” still. Removing Universal RP in package manager is the only difference between 5 minutes and a few seconds to “reload domain”

I need to update the bug report to give the solution to this:

https://fogbugz.unity3d.com/default.asp?1202878_j8tr84n1unjrtihk

This is happening because static references are not being cleaned up on exiting playmode when a scriptable render pipeline asset is in use. Making sure all static references to objects are cleaned on exiting playmode fixes this issue.