UCC integrations UIS failed in fresh project

Kehaw

Member
1. Character controller variant (Ultimate Character Controller, UFPS, etc).
Ultimate Character Controller 3.2

2. Unity version (include which SRP, beta Unity versions aren't supported)
Unity 2022.3.57f1 URP

3. Bug description
Use Inventory Manager Integrations tab-> Character Setup trying to integration, inventory component has nothing to show.

4. Steps to reproduce from a fresh project
Nothing todo, just use Inventory manager trying to integration character who created by UCC 3.2

5. The full error message (if any)


```
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateInventorySystem.Core.InventoryCollections.Inventory.Opsive.UltimateInventorySystem.Core.IDatabaseSwitcher.IsComponentValidForDatabase (Opsive.UltimateInventorySystem.Storage.InventorySystemDatabase database) (at ./Packages/com.opsive.ultimateinventorysystem/Scripts/Core/InventoryCollections/Inventory.cs:1015)
Opsive.UltimateInventorySystem.Editor.Inspectors.DatabaseInspectorBase.DrawContent () (at ./Packages/com.opsive.ultimateinventorysystem/Editor/Inspectors/DatabaseInspectorBase.cs:105)
Opsive.UltimateInventorySystem.Editor.Inspectors.DatabaseInspectorBase.DatabaseChanged () (at ./Packages/com.opsive.ultimateinventorysystem/Editor/Inspectors/DatabaseInspectorBase.cs:88)
Opsive.UltimateInventorySystem.Editor.Inspectors.DatabaseInspectorBase.DrawElements (UnityEngine.UIElements.VisualElement parent, System.Boolean nested) (at ./Packages/com.opsive.ultimateinventorysystem/Editor/Inspectors/DatabaseInspectorBase.cs:72)
Opsive.Shared.Editor.UIElements.UIElementsInspector.CreateInspectorGUI () (at <86e9a01e1ee94b75b81d877355439fda>:0)
Opsive.UltimateInventorySystem.Editor.Inspectors.DatabaseInspectorBase.CreateInspectorGUI () (at ./Packages/com.opsive.ultimateinventorysystem/Editor/Inspectors/DatabaseInspectorBase.cs:42)
UnityEditor.UIElements.InspectorElement.CreateInspectorElementUsingUIToolkit (UnityEditor.Editor targetEditor) (at <1a49100dc0894bfc95bed836b8ae4cdc>:0)
UnityEditor.UIElements.InspectorElement.CreateInspectorElementFromSerializedObject (UnityEditor.SerializedObject bindObject) (at <1a49100dc0894bfc95bed836b8ae4cdc>:0)
UnityEditor.UIElements.InspectorElement.ExecuteDefaultActionAtTarget (UnityEngine.UIElements.EventBase evt) (at <1a49100dc0894bfc95bed836b8ae4cdc>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <098156c18ae44cb896c6b86830055436>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtCurrentTargetAndPhase (UnityEngine.UIElements.EventBase evt) (at <098156c18ae44cb896c6b86830055436>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <098156c18ae44cb896c6b86830055436>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetAndDefaultPhase (UnityEngine.UIElements.EventBase evt) (at <098156c18ae44cb896c6b86830055436>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.SendBindingEvent[TEventType] (TEventType evt, UnityEngine.UIElements.VisualElement target) (at <75a5df9a2da2451798459724e3eec2c7>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.BindTree (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedProperty parentProperty) (at <75a5df9a2da2451798459724e3eec2c7>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.ContinueBinding (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedProperty parentProperty) (at <75a5df9a2da2451798459724e3eec2c7>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.Bind (UnityEngine.UIElements.VisualElement element) (at <75a5df9a2da2451798459724e3eec2c7>:0)
UnityEditor.UIElements.Bindings.DefaultSerializedObjectBindingImplementation.Bind (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedObject obj) (at <75a5df9a2da2451798459724e3eec2c7>:0)
UnityEditor.UIElements.BindingExtensions.Bind (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedObject obj) (at <1a49100dc0894bfc95bed836b8ae4cdc>:0)
UnityEditor.UIElements.InspectorElement..ctor (UnityEditor.SerializedObject obj, UnityEditor.Editor editor, UnityEditor.UIElements.InspectorElement+DefaultInspectorFramework defaultInspectorFramework) (at <1a49100dc0894bfc95bed836b8ae4cdc>:0)
UnityEditor.UIElements.InspectorElement..ctor (UnityEditor.Editor editor, UnityEditor.UIElements.InspectorElement+DefaultInspectorFramework defaultInspectorFramework) (at <1a49100dc0894bfc95bed836b8ae4cdc>:0)
UnityEditor.UIElements.InspectorElement..ctor (UnityEditor.Editor editor) (at <1a49100dc0894bfc95bed836b8ae4cdc>:0)
UnityEditor.UIElements.EditorElement.BuildInspectorElement () (at <1a49100dc0894bfc95bed836b8ae4cdc>:0)
UnityEditor.UIElements.EditorElement.CreateInspectorElement () (at <1a49100dc0894bfc95bed836b8ae4cdc>:0)
UnityEditor.EditorElementUpdater.CreateInspectorElementsForMilliseconds (System.Int64 targetMilliseconds) (at <1a49100dc0894bfc95bed836b8ae4cdc>:0)
UnityEditor.PropertyEditor.Update () (at <1a49100dc0894bfc95bed836b8ae4cdc>:0)
UnityEditor.HostView.SendUpdate () (at <1a49100dc0894bfc95bed836b8ae4cdc>:0)
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <1a49100dc0894bfc95bed836b8ae4cdc>:0)

```


All details here:

 
Thank you for reporting this bug, I was able to replicated with the latest update.
I'm sorry for the inconvinience. I will try to fix this asap and get back to you once I have a solution. And we will update the packages with the fix as soon as possible
 
Hello sorry for the delay.

The issue was quite simple. The array was not initialized before it was accessed causing the null exception error. I think this was caused either by a Unity update or an update on our part, skipping a scene saved after the character is setup and before the second step of setting up the inventory fo the character.
Normally if you closed and reopened Unity it would have worked.
 
But in any case here is the code fix in the ObjectAmounts.cs script:
Code:
    /// <summary>
    /// The base class of amounts array of an object.
    /// </summary>
    /// <typeparam name="T">The object type.</typeparam>
    /// <typeparam name="Ta">The object amount type.</typeparam>
    [System.Serializable]
    public class ObjectAmounts<T, Ta> : IReadOnlyList<Ta>, IObjectAmounts<Ta> where Ta : IObjectAmount<T> where T : class
    {
        [Tooltip("The array of object amount.")]
        [SerializeField] protected Ta[] m_Array = System.Array.Empty<Ta>();

        public Ta[] Array => m_Array;

        public int Count => m_Array?.Length ?? 0;

It will be part of the next update
 
But in any case here is the code fix in the ObjectAmounts.cs script:
Code:
    /// <summary>
    /// The base class of amounts array of an object.
    /// </summary>
    /// <typeparam name="T">The object type.</typeparam>
    /// <typeparam name="Ta">The object amount type.</typeparam>
    [System.Serializable]
    public class ObjectAmounts<T, Ta> : IReadOnlyList<Ta>, IObjectAmounts<Ta> where Ta : IObjectAmount<T> where T : class
    {
        [Tooltip("The array of object amount.")]
        [SerializeField] protected Ta[] m_Array = System.Array.Empty<Ta>();

        public Ta[] Array => m_Array;

        public int Count => m_Array?.Length ?? 0;

It will be part of the next update
Hello, I have been integration UCC and UIS manual right now :D , but still thanks for your job~!
 
Back
Top