Forum begins after the advertisement:

 


[Part 5] Slot inventory

Viewing 13 posts - 16 through 28 (of 28 total)
  • Author
    Posts
  • #18557
    Tarha Apustaja
    Level 5
    AI Assistant
    (BETA)
    Helpful?
    Up
    0
    ::

    It looks like you’ve made progress! From the screenshot, I can see that you’ve created ScriptableObject instances and assigned them to the InventoryManager component, which is great.

    As for the video reference, I would recommend going back to the section where the instructor demonstrates creating and assigning ScriptableObjects. Typically, this is covered when introducing inventory systems or item management. Look for keywords like “ScriptableObject,” “Item Data,” or “Inventory Setup” in the video title or timestamps.

    If you have a specific video in mind, let me know, and I can help you pinpoint the right parts to review! If you have any further questions about ScriptableObjects or the Unity setup, feel free to ask.

    #18561
    Terence
    Level 31
    Keymaster
    Helpful?
    Up
    0
    ::

    No worries @princesspixie. May I ask what locked you out (so I can tweak the server to reduce false positives)? Were you unable to access the site entirely?

    Regarding your project, can you open up the Tools and Items (circled below) tab in your UIManager?

    #18562
    Princess Pixie
    Level 3
    Participant
    Helpful?
    Up
    0
    ::

    Yeah, I was locked out of the site altogether. I did message on Patreon to get back in, but it took a couple of days for my internet to realize I was unbanned. I think. It wouldn’t even let me load the page.

    This is the screenshot I took of what you requested.

    View post on imgur.com
    #18563
    Tarha Apustaja
    Level 5
    AI Assistant
    (BETA)
    Helpful?
    Up
    0
    ::

    I apologize, but the image link you provided does not seem to be working or loading. Could you please re-upload the screenshot or describe what you see in the image?

    To help me understand your current situation better, could you clarify:

    1. What specific part of the inventory setup are you working on?
    2. Are you trying to assign items to the InventoryManager?
    3. Are you experiencing any specific errors or issues?
    #18564
    Princess Pixie
    Level 3
    Participant
    Helpful?
    Up
    0
    ::

    Sorry I took a screen shot of inventory manager not Ui manager here is the UI manager screenshot

    View post on imgur.com
    #18565
    Tarha Apustaja
    Level 5
    AI Assistant
    (BETA)
    Helpful?
    Up
    0
    ::

    Thank you for sharing the screenshot of the UI Manager. However, I’m unable to view images directly.

    To help you better, please describe what you see in the UI Manager. Here are a few questions that can help clarify the situation:

    1. Have you assigned the necessary UI elements (like buttons, panels, etc.) to the UI Manager in the Inspector?
    2. Are there any specific fields in the UI Manager that you are unsure about?
    3. Are you encountering any errors or issues related to the UI Manager when testing your game?

    Feel free to provide any details or questions you have, and I’ll do my best to assist you!

    #18566
    Jonathan Teo
    Level 18
    Moderator
    Helpful?
    Up
    0
    ::

    Could you take a screenshot or a short recording of how each inventory slot shows up in the index value when in play mode?

    #18593
    Princess Pixie
    Level 3
    Participant
    Helpful?
    Up
    0
    ::

    So before I do that I exited out of unity and came back to it today and it now has this error is hasnt been showing up until today. I will post it here and take a screen shot of it.

    NullReferenceException: Object reference not set to an instance of an object InventorySlot.Display (ItemData itemToDisplay) (at Assets/Scripts/UI/InventorySlot.cs:30) UIManager.RenderInventoryPanel (ItemData[] slots, InventorySlot[] uiSlots) (at Assets/Scripts/UI/UIManager.cs:100) UIManager.RenderInventory () (at Assets/Scripts/UI/UIManager.cs:74) UIManager.Start () (at Assets/Scripts/UI/UIManager.cs:45)

    Here is a screenshot. https://imgur.com/a/oHv76mi

    #18594
    Tarha Apustaja
    Level 5
    AI Assistant
    (BETA)
    Helpful?
    Up
    0
    ::

    Based on the error trace, this looks like a null reference issue in your InventorySlot.Display method, specifically on line 30. This typically means one of two things:

    1. Your InventoryManager’s tools or items arrays are not fully populated
    2. Your InventorySlot references in the UI Manager are not correctly assigned

    To diagnose:

    • Check that InventoryManager has valid ScriptableObject items in its tools and items arrays
    • Verify all InventorySlot references in UIManager are properly assigned in the Inspector
    • Ensure no slots are left empty or unassigned

    Can you confirm:

    1. Are all tool and item slots in InventoryManager filled with ScriptableObject instances?
    2. Did you recently modify your inventory setup or scripts?
    #18595
    Princess Pixie
    Level 3
    Participant
    Helpful?
    Up
    0
    ::

    Now its saying this

    NullReferenceException: Object reference not set to an instance of an object InventorySlot.Display (ItemData itemToDisplay) (at Assets/Scripts/UI/InventorySlot.cs:38) UIManager.RenderInventoryPanel (ItemData[] slots, InventorySlot[] uiSlots) (at Assets/Scripts/UI/UIManager.cs:100) UIManager.RenderInventory () (at Assets/Scripts/UI/UIManager.cs:74) UIManager.Start () (at Assets/Scripts/UI/UIManager.cs:45)

    #18596
    Tarha Apustaja
    Level 5
    AI Assistant
    (BETA)
    Helpful?
    Up
    0
    ::

    Based on the error trace, this is still a null reference issue, now occurring on line 38 of InventorySlot.cs.

    Potential causes:

    1. itemDisplayImage is not assigned in the InventorySlot script
    2. A ScriptableObject reference is missing or not properly set up

    Recommended immediate checks:

    • In the Inspector, ensure each InventorySlot has its itemDisplayImage field assigned
    • Verify that your ScriptableObject items have valid thumbnails
    • Double-check that InventoryManager’s tools and items arrays are populated with actual items

    Could you confirm:

    1. Have you assigned the Image component to itemDisplayImage for each InventorySlot?
    2. Do all your ScriptableObject items have thumbnails set?
    #18597
    Princess Pixie
    Level 3
    Participant
    Helpful?
    Up
    2
    ::

    I finally figure it out thank you. Turns out there was mutplie scripts being put into my inventory slots everytime I would go to the prefab it would just add another of inventory slot script.

    and 1 other person have upvoted this post.
    #18598
    Tarha Apustaja
    Level 5
    AI Assistant
    (BETA)
    Helpful?
    Up
    0
    ::

    Great job solving the issue! Multiple script instances on the same GameObject can indeed cause unexpected behavior and errors. Always ensure you have only one instance of a script per GameObject when working with prefabs in Unity.

    Would you like to share more details about how you resolved the multiple script problem?

Viewing 13 posts - 16 through 28 (of 28 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: