After upgrading our project to B9, when exiting play-mode, we now have the following error:
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.Rendering.Universal.ShadowCasterGroup2DManager.OnPlayModeStateChanged (UnityEditor.PlayModeStateChange state) (at Library/PackageCache/com.unity.render-pipelines.universal@12.0.0/Runtime/2D/Shadows/ShadowCasterGroup2DManager.cs:30)
UnityEditor.EditorApplication.Internal_PlayModeStateChanged (UnityEditor.PlayModeStateChange state) (at <9de32d58e117474d9df95577a7ba5c6d>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
Solution for anyone that wants to get around it for now… in your project, scroll down to Packages in Project window, right-click Universal RP, click Show In Explorer. Then copy the folder to a location of your choosing. Then open that folder/Runtime/2D/Shadows/ShadowCasterGroup2DManager.cs, replace OnPlayModeStateChanged function with this:
private static void OnPlayModeStateChanged(PlayModeStateChange state)
{
if (s_ShadowCasterGroups != null)
{
if (state == PlayModeStateChange.ExitingEditMode || state == PlayModeStateChange.ExitingPlayMode)
s_ShadowCasterGroups.Clear();
}
}
Then open Package Manager, click the +, click “Add package from disk” and browse to that folder/package.json file. The error should then be gone. You can pick the unedited/official version again whenever from Package Manager.
TBH it is a bit of a nooby coding mistake Looking at the source I can’t imagine why anyone wouldn’t think that would cause problems even while typing it. It’s just plain sloppy really. Beta is beta though so I’ll go back in my box.
I just had occasion to try this - good tip. The GameObject it’s attached to must also be active in the scene and the component must be enabled at the time the error would be thrown.
Not to speak of anyone around here in particular, but in the industry it’s often what’s called “proliferation”. I’ve seen it - in person, in real life - large rooms full of people getting paid good money to spend all day writing fake comments, reviews, giving likes, hating, shaming, tweeting, lying and so on. Sometimes it’s bots or auto-responder style scripts, which is partially to blame for why a lot of comments around the internet don’t make sense or have anything to do with what’s being talked about (since accuracy with that stuff isn’t a perfect science, yet).
Of course, that’s not always the case, some people doing it are honest but have had a run of bad luck, or are the type to blame a car they wreck for an accident, or just plain ignorant, or parotting some comment they read - so nobody calls it out. Besides that, everyone’s entitled to an opinion - and at the end of the day it’s up to each of us to decide whose opinion to value. And if it’s really offensive …as noted above, there is the Ignore feature, I use that one in real life too