Exception when creating prefab item

Chickenfield

New member
Hi,
I was playing around with v3 of the character controller and wanted to create an item prefab. So, following the documentation, I did the following in a fresh project with nothing but UFPSv3 imported:

1.) Added a new item type in demo collection, same settings as assault rifle: Categories "Items" and "Two Hand Shootables", Capacity 1
2.) Created new item, dropping in an arbitrary model as Item, Item Definition as the item type created in the previous step, Animator Item ID 1, an empty Animator Controller into first and third person animator controllers.

Upon clicking on "Build Item" and selecting the standard directory, /Assets/, I get the following exception with this stack trace, leaving the item itself in the hierarchy. This happens in the demo scene, and in an empty scene.

ArgumentException: UnpackPrefabInstance must be called with a Prefab instance.
UnityEditor.PrefabUtility.UnpackPrefabInstance (UnityEngine.GameObject instanceRoot, UnityEditor.PrefabUnpackMode unpackMode, UnityEditor.InteractionMode action) (at <5e26277f966d4f80afa5d51573eba699>:0)
Opsive.UltimateCharacterController.Editor.Managers.ItemManager.BuildItemComplete (UnityEngine.GameObject item) (at Assets/Opsive/UltimateCharacterController/Editor/Managers/ItemManager.cs:1154)
Opsive.UltimateCharacterController.Editor.Managers.ItemManager.BuildItem () (at Assets/Opsive/UltimateCharacterController/Editor/Managers/ItemManager.cs:1119)
Opsive.UltimateCharacterController.Editor.Managers.ItemManager+<>c__DisplayClass35_0.<ShowItem>b__9 () (at Assets/Opsive/UltimateCharacterController/Editor/Managers/ItemManager.cs:536)
UnityEngine.UIElements.Clickable.Invoke (UnityEngine.UIElements.EventBase evt) (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.Clickable.ProcessUpEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.Vector2 localPosition, System.Int32 pointerId) (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.Clickable.OnMouseUp (UnityEngine.UIElements.MouseUpEvent evt) (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.PropagationPhase propagationPhase) (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.EventCallbackRegistry.InvokeCallbacks (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.PropagationPhase propagationPhase) (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.TextElement.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <fbddd4b6a38a43f8acee7fd19fb6ee84>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <dd3e446df64a4cc4811a8f1adf352c16>:0)

The prefab gets created nevertheless. Is this a bug, or did I miss anything?

Best regards
 
Thank you. I am guessing that your gun model is located within the project and not the scene? If you first drag it into the scene then it should work without any errors, but I'll also fix this case in the next update.
 
Correct, my model is located within the project and not in the scene. After putting it in my scene and then creating the item, it works as expected. Thanks!
 
Top