freezy / VisualPinball.Engine

:video_game: Visual Pinball Engine for Unity
https://docs.visualpinball.org
GNU General Public License v3.0
415 stars 62 forks source link

Error when creating bumper with URP #477

Closed arthurkehrwald closed 1 month ago

arthurkehrwald commented 1 month ago

https://github.com/user-attachments/assets/7fc3b2d9-31de-46d9-95e8-2e37cf5580ba

When using the universal render pipeline, creating a bumper using the Toolbox sidebar causes two error messages to appear. As long as the bumper is present, no more objects can be created and the error messages repeat when attempting to create any object, not just bumpers. Deleting the bumper solves the problem.

Error 1

NullReferenceException: Object reference not set to an instance of an object
VisualPinball.Unity.BumperComponent.CopyDataTo (VisualPinball.Engine.VPT.Bumper.BumperData data, System.String[] materialNames, System.String[] textureNames, System.Boolean forExport) (at ./Packages/VisualPinball.Engine/VisualPinball.Unity/VisualPinball.Unity/VPT/Bumper/BumperComponent.cs:252)
VisualPinball.Unity.SceneTableContainer.Add (VisualPinball.Unity.IMainComponent comp, System.Boolean forExport) (at ./Packages/VisualPinball.Engine/VisualPinball.Unity/VisualPinball.Unity/VPT/Table/SceneTableContainer.cs:234)
VisualPinball.Unity.SceneTableContainer.RefreshChild (UnityEngine.Component node, System.Boolean forExport) (at ./Packages/VisualPinball.Engine/VisualPinball.Unity/VisualPinball.Unity/VPT/Table/SceneTableContainer.cs:223)
VisualPinball.Unity.SceneTableContainer+<>c__DisplayClass23_0.<Refresh>b__0 (UnityEngine.Transform node) (at ./Packages/VisualPinball.Engine/VisualPinball.Unity/VisualPinball.Unity/VPT/Table/SceneTableContainer.cs:111)
VisualPinball.Unity.SceneTableContainer.WalkChildren (System.Collections.IEnumerable node, System.Action`1[T] action) (at ./Packages/VisualPinball.Engine/VisualPinball.Unity/VisualPinball.Unity/VPT/Table/SceneTableContainer.cs:216)
VisualPinball.Unity.SceneTableContainer.WalkChildren (System.Collections.IEnumerable node, System.Action`1[T] action) (at ./Packages/VisualPinball.Engine/VisualPinball.Unity/VisualPinball.Unity/VPT/Table/SceneTableContainer.cs:217)
VisualPinball.Unity.SceneTableContainer.WalkChildren (System.Collections.IEnumerable node, System.Action`1[T] action) (at ./Packages/VisualPinball.Engine/VisualPinball.Unity/VisualPinball.Unity/VPT/Table/SceneTableContainer.cs:217)
VisualPinball.Unity.SceneTableContainer.Refresh (System.Boolean forExport) (at ./Packages/VisualPinball.Engine/VisualPinball.Unity/VisualPinball.Unity/VPT/Table/SceneTableContainer.cs:111)
VisualPinball.Unity.Editor.ToolboxEditor.CreateItem[TItem] (System.Func`2[T,TResult] create, System.String actionName) (at ./Packages/VisualPinball.Engine/VisualPinball.Unity/VisualPinball.Unity.Editor/Toolbox/ToolboxEditor.cs:214)
VisualPinball.Unity.Editor.ToolboxEditor.OnGUI () (at ./Packages/VisualPinball.Engine/VisualPinball.Unity/VisualPinball.Unity.Editor/Toolbox/ToolboxEditor.cs:119)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition) (at <50e19b0ed93a4256b2e454b4acec2d48>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect dockAreaRect) (at <50e19b0ed93a4256b2e454b4acec2d48>:0)
UnityEditor.DockArea.OldOnGUI () (at <50e19b0ed93a4256b2e454b4acec2d48>: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 <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.IMGUIContainer.ProcessEvent (UnityEngine.UIElements.EventBase evt) (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtCurrentTargetAndPhase (UnityEngine.UIElements.EventBase evt) (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <7ec34a9fe0b043f08800d3612cbf36c3>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <1b603076721a49e29a4f83c592d24b9f>:0)

Error2

GUI Error: Invalid GUILayout state in ToolboxEditor view. Verify that all layout Begin/End calls match
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

The cause of the issue is that the bumper prefab from the URP support package has missing meshes. This should also be fixed, but in my opinion, it should not cause such a disruptive error.