Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  NullReferenceException Blueprint Edit
#1
Pregunta 
Hello,

When I create a Blueprint, I'm able to Generate it, but when I click Edit, I get a NullReferenceException that repeats every few seconds, and the scene that opens is empty. I've switched to the Default layout, and that didn't fix it. I switched projects, tried again, and had the same issue.

I'm using MacOS Monterey 12.5.1, and Unity 2022.2.0b10.

P.s. I found a similar thread by GinHuang, and even though it was not quite the same problem, I downloaded the patched 'ObiSkinnedClothBlueprint.cs' with fingers crossed but it did not resolve my issue.


Here's the error:

NullReferenceException: Object reference not set to an instance of an object
Obi.ObiActorBlueprintEditor.OnSceneGUI (UnityEditor.SceneView sceneView) (at Assets/Obi/Editor/Common/Blueprints/ObiActorBlueprintEditor.cs:336)
UnityEditor.SceneView.CallOnSceneGUI () (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:3780)
UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2811)
UnityEditor.SceneView.DoOnGUI () (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2481)
UnityEditor.SceneView.OnSceneGUI () (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2322)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:376)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:675)
UnityEngine.UIElements.IMGUIContainer.DoIMGUIRepaint () (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:535)
UnityEngine.UIElements.UIR.RenderChainCommand.ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams drawParams, System.Single pixelsPerPoint, System.Exception& immediateException) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Renderer/UIRenderer/UIRenderers.cs:130)
Rethrow as ImmediateModeException
UnityEngine.UIElements.UIR.RenderChain.Render () (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Renderer/UIRRenderChain.cs:518)
UnityEngine.UIElements.UIRRepaintUpdater.Update () (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Renderer/UIRRepaintUpdater.cs:79)
UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/VisualTreeUpdater.cs:111)
UnityEngine.UIElements.Panel.UpdateForRepaint () (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Panel.cs:997)
UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Panel.cs:1058)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:453)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:205)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:74)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:28)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
Reply
#2
Hi!

Other times I've seen this issue pop up has always been because of a long-standing bug in Unity's editor window layout system: having multiple inspectors open while one of them is locked triggers it, and the usual solution is to reset the layout (as this gets rid of the extra locked inspectors).

The line the error refers to accesses "ObiActorBlueprintEditor.currentProperty", which is a list that should be initialized when the inspector window is first instantiated. For some reason, sometimes Unity instantiates the editor window but doesn't call any of the object initializers in the class. As a result, these are null when trying to access them.

I'll try to reproduce this with the Unity version you're using and file a bug report with Unity if necessary. If resetting the window layout doesn't work for you, and assuming you're in a production environment, I'd suggest trying a stable Unity version. 2022.2.0b10. is a beta, as such it should be expected to be unstable and contain many bugs. Beta versions should *only* be used for testing/evaluation purposes, never for actual development.

kind regards,
Reply
#3
I'd reverted to the Default layout, and the issue remained. It's a team / cloud project, and the project leads have everyone upgrade when there's an experimental feature they're interested in, or attempting to fix something broken.

We moved off the beta to the '1f1' release now, and I'm pleased to say that fixed it! Thanks!
Reply
#4
(19-12-2022, 07:27 PM)brootas Wrote: We moved off the beta to the '1f1' release now, and I'm pleased to say that fixed it! Thanks!

Glad to hear that! Let me know if you stumble upon this issue again.

kind regards,
Reply
#5
Dedo arriba 
Got the same bug in Obi Cloth 6.5.2 and Unity 2019.4.40f1 (LTS), also fixed by changing Layout to "2 by 3"

A comment in there would be nice, I spent an hour or two digging around for null Selections and Meshes or whatever.
Both "Trenchcoat" Obi assets gave me similar bugs. One was in "ObiActorBlueprintEditor" at line 336. currentProperty.OnSceneRepaint(), currentProperty was null. That also seems to be fixed by changing the Layout.
Reply