Search Issue Tracker

Fixed in 4.3.0

Votes

0

Found in [Package]

3.0.0

Issue ID

1208475

Regression

No

[Probuilder] NullReferenceException in ProBuilder.TransformUtility.ReparentChildren when centring pivot on parent obj

Package: Probuilder

-

A series of errors pop in the console when attempting to centre the pivot of a probuilder object.

Repro steps:
- made a cube and modified it a bit - called it car
- made 4 cylinders and aligned them with the car as wheels
- parented the wheels to the car
- now, i tried to centre the pivot of the car (parent), because it was a bit offset

The following things happened:
- A lot of null ref exceptions appeared int he console
- the wheels moved their position
- I pressed align again, the wheels became un-parented to the car
- when trying to press undo to the transforms, the Wheels duplicated - there were now 8 wheels, instead of 4, 4 of which were still parented to the Car (see image)
- when attempting to select the wheel objects, 2 wheels were being selected
- Unity crashed as i was selecting the wheels in the scene hierarchy.

Note! I tried to reproduce the crash again in a new project, but couldn't.

Reproducible with Unity 2019.3.0f4 and 2020.1.0a18, 2018.4.5f1
Reproducible with Probulider 4.3.0 and 4.2.1, 3.10.1 and 3.0.0

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.ProBuilder.TransformUtility.ReparentChildren (UnityEngine.Transform t) (at Library/PackageCache/com.unity.probuilder@4.3.0-preview.1/Runtime/Core/TransformUtility.cs:42)
UnityEditor.ProBuilder.Actions.CenterPivot.DoAction () (at Library/PackageCache/com.unity.probuilder@4.3.0-preview.1/Editor/MenuActions/Object/CenterPivot.cs:55)
UnityEditor.ProBuilder.MenuAction.DoButton (System.Boolean isHorizontal, System.Boolean showOptions, UnityEngine.Rect& optionsRect, UnityEngine.GUILayoutOption[] layoutOptions) (at Library/PackageCache/com.unity.probuilder@4.3.0-preview.1/Editor/EditorCore/MenuAction.cs:337)
UnityEditor.ProBuilder.EditorToolbar.OnGUI () (at Library/PackageCache/com.unity.probuilder@4.3.0-preview.1/Editor/EditorCore/EditorToolbar.cs:370)
UnityEditor.ProBuilder.ProBuilderEditor.OnGUI () (at Library/PackageCache/com.unity.probuilder@4.3.0-preview.1/Editor/EditorCore/ProBuilderEditor.cs:476)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at <abcb5714b99e4fb3a117425953eb603c>:0)
UnityEditor.HostView.Invoke (System.String methodName) (at <abcb5714b99e4fb3a117425953eb603c>:0)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <abcb5714b99e4fb3a117425953eb603c>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <abcb5714b99e4fb3a117425953eb603c>:0)
UnityEditor.DockArea.OldOnGUI () (at <abcb5714b99e4fb3a117425953eb603c>:0)

ArgumentException: An item with the same key has already been added. Key: Car (UnityEngine.Transform)
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEngine.ProBuilder.TransformUtility.UnparentChildren (UnityEngine.Transform t) (at Library/PackageCache/com.unity.probuilder@4.3.0-preview.1/Runtime/Core/TransformUtility.cs:28)
UnityEditor.ProBuilder.Actions.CenterPivot.DoAction () (at Library/PackageCache/com.unity.probuilder@4.3.0-preview.1/Editor/MenuActions/Object/CenterPivot.cs:52)
UnityEditor.ProBuilder.MenuAction.DoButton (System.Boolean isHorizontal, System.Boolean showOptions, UnityEngine.Rect& optionsRect, UnityEngine.GUILayoutOption[] layoutOptions) (at Library/PackageCache/com.unity.probuilder@4.3.0-preview.1/Editor/EditorCore/MenuAction.cs:337)
UnityEditor.ProBuilder.EditorToolbar.OnGUI () (at Library/PackageCache/com.unity.probuilder@4.3.0-preview.1/Editor/EditorCore/EditorToolbar.cs:370)
UnityEditor.ProBuilder.ProBuilderEditor.OnGUI () (at Library/PackageCache/com.unity.probuilder@4.3.0-preview.1/Editor/EditorCore/ProBuilderEditor.cs:476)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at <abcb5714b99e4fb3a117425953eb603c>:0)
UnityEditor.HostView.Invoke (System.String methodName) (at <abcb5714b99e4fb3a117425953eb603c>:0)

Assertion failed on expression: '0 < GetDeepChildCount(hierarchy, index) + addedNodeCount'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

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.