Search Issue Tracker

Fixed in 12.0.0



Found in [Package]


Issue ID




[URP] NullReference Exception is thrown on changing "Light Type" under Light 2D (Experimental) in prefab asset

Package: Scriptable Render Pipeline Universal


On changing "Light Type" under Light 2D(Experimental) in prefab asset editor throws NullReference Exception, refer to the attached video

Steps to Reproduce:
1. Create new project with URP Template
2. Project > right-click > Rendering > Universal Render Pipeline > 2D Renderer
3. Project > Settings > UniversalRP-HighQuality > Inspector > Add 2D Renderer in Renderer List
4. Hierachy > right-click > Lighting > 2D > Parametric Light 2D > Create prefab of Parametric Light 2D
5. Project > Parametric Light 2D > Inspector > Change Light Type

Actual result: NullReference Exception is thrown on Changing "Light Type" In Light 2D(Experimental) in prefab asset

Expected result: Light Type change gracefully

Reproducible on:
2021.1.0a7, 2020.2.0b14 with Package Version 10.2.0
2021.1.0a4, 2020.2.0b10,2020.2.0b9 with Package Version 10.1.0

Working fine on:
2021.1.0a3 with Package Version 8.1.0
2020.2.0b9 with Package Version 10.0.0-Preview 26

Environment: Windows 10 and Mac 10.14

Stack trace:
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.Experimental.Rendering.Universal.LightUtility.GenerateParametricMesh (UnityEngine.Mesh mesh, System.Single radius, System.Single falloffDistance, System.Single angle, System.Int32 sides) (at Library/PackageCache/com.unity.render-pipelines.universal@10.2.0/Runtime/2D/LightUtility.cs:130)
UnityEngine.Experimental.Rendering.Universal.Light2D.UpdateMesh () (at Library/PackageCache/com.unity.render-pipelines.universal@10.2.0/Runtime/2D/Light2D.cs:155)
UnityEditor.Experimental.Rendering.Universal.Light2DEditor.OnInspectorGUI () (at Library/PackageCache/com.unity.render-pipelines.universal@10.2.0/Editor/2D/Light2DEditor.cs:645)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <a3d19fcb75d5423995f038fd978f8223>:0)
UnityEditor.PopupCallbackInfo:SetEnumValueDelegate(Object, String[], Int32)

  1. Resolution Note (fix version 12.0.0):

    A fix for this issue is available on Universal RP package 12.0.0 and above with Unity 2021.2.0a9

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.