Forum begins after the advertisement:
[Part 5] Slot inventory
Home › Forums › Video Game Tutorial Series › Creating a Farming RPG in Unity › [Part 5] Slot inventory
- This topic has 16 replies, 4 voices, and was last updated 2 days, 22 hours ago by
Tarha Apustaja.
-
AuthorPosts
-
July 22, 2025 at 4:10 am #18557::
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.
July 22, 2025 at 9:36 pm #18561::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
?July 23, 2025 at 2:38 am #18562::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
July 23, 2025 at 2:40 am #18563::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:
- What specific part of the inventory setup are you working on?
- Are you trying to assign items to the InventoryManager?
- Are you experiencing any specific errors or issues?
July 23, 2025 at 3:10 am #18564::Sorry I took a screen shot of inventory manager not Ui manager here is the UI manager screenshot
View post on imgur.com
July 23, 2025 at 3:10 am #18565::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:
- Have you assigned the necessary UI elements (like buttons, panels, etc.) to the UI Manager in the Inspector?
- Are there any specific fields in the UI Manager that you are unsure about?
- 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!
July 23, 2025 at 9:16 am #18566::Could you take a screenshot or a short recording of how each inventory slot shows up in the index value when in play mode?
July 29, 2025 at 3:52 am #18593::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
July 29, 2025 at 3:55 am #18594::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:
- Your InventoryManager’s tools or items arrays are not fully populated
- 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:
- Are all tool and item slots in InventoryManager filled with ScriptableObject instances?
- Did you recently modify your inventory setup or scripts?
July 29, 2025 at 4:18 am #18595::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)
July 29, 2025 at 4:20 am #18596::Based on the error trace, this is still a null reference issue, now occurring on line 38 of InventorySlot.cs.
Potential causes:
- itemDisplayImage is not assigned in the InventorySlot script
- 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:
- Have you assigned the Image component to itemDisplayImage for each InventorySlot?
- Do all your ScriptableObject items have thumbnails set?
July 29, 2025 at 4:31 am #18597::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. July 29, 2025 at 4:35 am #18598::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?
-
AuthorPosts
- You must be logged in to reply to this topic.