Obi Official Forum

Full Version: Random null error when editing cloth BP
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I can edit the cloth blueprint few times and after 5th or sometimes second it dissapears and gives null errors


Code:
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:311)
UnityEditor.SceneView.CallOnSceneGUI () (at <8c48e4bc2ff34638b69095cbb65e2e27>:0)
UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at <8c48e4bc2ff34638b69095cbb65e2e27>:0)
UnityEditor.SceneView.OnGUI () (at <8c48e4bc2ff34638b69095cbb65e2e27>:0)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <8c48e4bc2ff34638b69095cbb65e2e27>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <8c48e4bc2ff34638b69095cbb65e2e27>:0)
UnityEditor.DockArea.OldOnGUI () (at <8c48e4bc2ff34638b69095cbb65e2e27>:0)
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 <0050475d167947ea9f166ad030caa84f>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <0050475d167947ea9f166ad030caa84f>:0)
UnityEngine.UIElements.IMGUIContainer.DoIMGUIRepaint () (at <0050475d167947ea9f166ad030caa84f>:0)
UnityEngine.UIElements.UIR.RenderChainCommand.ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams drawParams, System.Single pixelsPerPoint, System.Exception& immediateException) (at <0050475d167947ea9f166ad030caa84f>:0)
Rethrow as ImmediateModeException
UnityEngine.UIElements.UIR.RenderChain.Render () (at <0050475d167947ea9f166ad030caa84f>:0)
UnityEngine.UIElements.UIRRepaintUpdater.Update () (at <0050475d167947ea9f166ad030caa84f>:0)
UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <0050475d167947ea9f166ad030caa84f>:0)
UnityEngine.UIElements.Panel.UpdateForRepaint () (at <0050475d167947ea9f166ad030caa84f>:0)
UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at <0050475d167947ea9f166ad030caa84f>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <0050475d167947ea9f166ad030caa84f>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <0050475d167947ea9f166ad030caa84f>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <0050475d167947ea9f166ad030caa84f>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <0050475d167947ea9f166ad030caa84f>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <f8197c5efb504ab8a77daf7d0e9abc5e>:0)
One thing i can add is that after this point any new added blueprints dont work when editing.
(18-04-2021, 11:04 PM)Mmero Wrote: [ -> ]One thing i can add is that after this point any new added blueprints dont work when editing.

Hi Mmero,

Had another user report a similar issue on Unity 2020.2. What Unity version are you using?
(19-04-2021, 07:42 AM)josemendez Wrote: [ -> ]Hi Mmero,

Had another user report a similar issue on Unity 2020.2. What Unity version are you using?


2020.2.6f1
Any idea how to resolve this issue?

From my perspective i bought the asset that just doesnt work.

Assetstore page doesnt say anything about "this asset doesnt work in versions 2020.1 and above"
Hi there,

(19-04-2021, 08:32 PM)Mmero Wrote: [ -> ]Any idea how to resolve this issue?
It has been reported only very recently, so still figuring it out. Judging from the stack trace, the culprit is a variable that should be initialized but it isn't. That variable is initialized when the editor gets its OnEnable() called, so it should *always* be initialized. Coupled with the fact that this only happens in 2020.2 and up, makes it look like a bug in Unity. I hope to have more details today.

(19-04-2021, 08:32 PM)Mmero Wrote: [ -> ]From my perspective i bought the asset that just doesnt work.

Assetstore page doesnt say anything about "this asset doesnt work in versions 2020.1 and above"

I'm fully aware of this, my apologies. The asset is supposed to work in 2020.2 just fine. Will investigate and provide a patch asap.
So far I've been unable to reproduce this. Tried 2020.2.6f1 and 2020.3.0 without success.

The stack trace points to a NullRefException in this line:

Code:
currentProperty.OnSceneRepaint();

The only thing that can be null here is currentProperty. This grabs the first property in the properties list, initialized in the editor's  OnEnable():

Code:
properties.Add(new ObiBlueprintMass(this));
properties.Add(new ObiBlueprintRadius(this));
properties.Add(new ObiBlueprintLayer(this));

So as long as Unity is calling OnEnable() -as it should- there's literally no way currentProperty can be null.

- You mentioned this happens 5 seconds or so after opening the blueprint editor, is this correct?
- Can you share the mesh you're using to generate the blueprint?

Also, can you try resetting Unity's window layout (Window->Layouts->Reset All Layouts)? 2020.X has a fair share of layout-related editor issues, some of them have affected us in the past. Just to make sure this isn't layout relayed.
I upgraded the unity version and the problem doesn't show up Sonrisa

Now I'm having a problem with cloth properties but this is for another topic
One of those unsolved Unity mysteries  Huh  . I'd actually like to get this to happen to me so that I can investigate and fully understand the issue, but this one is slippery!

Glad you got it working though.  Let me know if I can help in any way. Sonrisa
Got the same (Unity 2019.4.22f1) found a working temporary fix:

Look at the code added by // SDP tag

ObiActorBluePrintEditor.cs

[attachment=997]

Selectable.cs (in Unity source code Unity.app/Contents/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Selectable.cs)

[attachment=998]

[attachment=996]


Can be useful if upgrading your Unity is not an option
Pages: 1 2