Search Unity

Bug (Case 1287276) NullReferenceException when Adding Block

Discussion in 'Visual Effect Graph' started by florianhanke, Oct 23, 2020.

  1. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    426
    When adding a block via spacebar or mouse right click on macOS Unity 2020.1.10f, VFX Graph 9.0.0-preview.54 I get the following error which appears to stem from the fact that the UI Toolkit 1.0.0-preview.9 and my version of the VFX Graph appear to not work together without issue:
    Code (Boo):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEngine.UIElements.TextUtilities.MeasureVisualElementTextSize (UnityEngine.UIElements.VisualElement ve, System.String textToMeasure, System.Single width, UnityEngine.UIElements.VisualElement+MeasureMode widthMode, System.Single height, UnityEngine.UIElements.VisualElement+MeasureMode heightMode, UnityEngine.UIElements.ITextHandle textHandle) (at Library/PackageCache/com.unity.ui@1.0.0-preview.9/Core/Text/TextHandle.cs:358)
    3. UnityEngine.UIElements.TextElement.MeasureTextSize (System.String textToMeasure, System.Single width, UnityEngine.UIElements.VisualElement+MeasureMode widthMode, System.Single height, UnityEngine.UIElements.VisualElement+MeasureMode heightMode) (at Library/PackageCache/com.unity.ui@1.0.0-preview.9/Core/TextElement.cs:283)
    4. UnityEngine.UIElements.TextElement.DoMeasure (System.Single desiredWidth, UnityEngine.UIElements.VisualElement+MeasureMode widthMode, System.Single desiredHeight, UnityEngine.UIElements.VisualElement+MeasureMode heightMode) (at Library/PackageCache/com.unity.ui@1.0.0-preview.9/Core/TextElement.cs:298)
    5. UnityEngine.UIElements.VisualElement.Measure (UnityEngine.Yoga.YogaNode node, System.Single width, UnityEngine.Yoga.YogaMeasureMode widthMode, System.Single height, UnityEngine.Yoga.YogaMeasureMode heightMode) (at Library/PackageCache/com.unity.ui@1.0.0-preview.9/Core/VisualElement.cs:1486)
    6. UnityEngine.UIElements.VisualElement.<AssignMeasureFunction>b__321_0 (UnityEngine.Yoga.YogaNode node, System.Single f, UnityEngine.Yoga.YogaMeasureMode mode, System.Single f1, UnityEngine.Yoga.YogaMeasureMode heightMode) (at Library/PackageCache/com.unity.ui@1.0.0-preview.9/Core/VisualElement.cs:1470)
    7. UnityEngine.Yoga.YogaNode.MeasureInternal (UnityEngine.Yoga.YogaNode node, System.Single width, UnityEngine.Yoga.YogaMeasureMode widthMode, System.Single height, UnityEngine.Yoga.YogaMeasureMode heightMode) (at /Users/bokken/buildslave/unity/build/External/Yoga/csharp/Facebook.Yoga/YogaNode.cs:689)
    8. UnityEngine.Yoga.Native.YGNodeMeasureInvoke (UnityEngine.Yoga.YogaNode node, System.Single width, UnityEngine.Yoga.YogaMeasureMode widthMode, System.Single height, UnityEngine.Yoga.YogaMeasureMode heightMode, System.IntPtr returnValueAddress) (at /Users/bokken/buildslave/unity/build/External/Yoga/csharp/Facebook.Yoga/YogaNative.bindings.cs:146)
    9. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
    10.  

    Adding via mouse:
    vfx-graph-ui-toolkit-issue.gif

    Adding via spacebar:
    vfx-graph-ui-toolkit-issue-2.gif

    Note that the position is not under the mouse in the spacebar case and the initial state of the block is somewhat broken (probably due to the NullReferenceException). Sometimes, the error stops the block selection modal to be closed and it stays open.

    I'll also try to file a bug – will post the Case number under this post as soon as I have one.

    P.S: I'll cross reference this post also in the UI Toolkit forum.
     
  2. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    426
    Case 1287276
     
  3. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    780
    I'm pretty sure this will be fixed in the next release.

    We'll keep you posted through the case.
     
    florianhanke likes this.
  4. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    426
    Thanks for the quick response!