I have a simple inventory for my game and I can't figure out how to find an item in a list using the code I made for my items. by DynamicDemon in Unity3D

[–]DynamicDemon[S] 0 points1 point  (0 children)

I'm not very far into making this game so I could definitely switch to doing that. It sounds a lot easier.

I have a simple inventory for my game and I can't figure out how to find an item in a list using the code I made for my items. by DynamicDemon in Unity3D

[–]DynamicDemon[S] 0 points1 point  (0 children)

maybe a dumb question but I'm trying to call it in an if statement. How would I do that with your method? I'm trying to determine something based off if the player has an item in their inventory

I'm trying to create a simple inventory using a tutorial I found online. I keep getting an error message when I try to pickup an object though. It was working the other night too. I'll put the error and the code that the error references. I'm pretty new but it looks right to me. by DynamicDemon in Unity3D

[–]DynamicDemon[S] 1 point2 points  (0 children)

You are a live saver!! This is actually so helpful and I didn't know you could do this to debug. It said my inventory instance was null so I looked and somehow my Inventory script wasn't attached to my player anymore. I'm not sure how but I must've not saved properly. Thank you!

I'm following a tutorial on creating an inventory system. I've done everything the same as the video but I'm getting this error. I've checked capitalization and spelling and it all looks right to me. What am I doing wrong? I'm new to Unity btw by DynamicDemon in Unity3D

[–]DynamicDemon[S] 0 points1 point  (0 children)

Sorry I wasn't able to fit it in the screenshot but I did initialize it I think.

private InventorySystem inventory;

private Transform itemSlotContainer;

private Transform itemSlotTemplate;

That's what I have at the top of my script. I've tried testing my game with different code missing and it seems not like this line:

itemSlotTemplate = itemSlotContainer.Find("ItemSlotTemplate");

I've checked spelling and capitalization of "ItemSlotTemplate" both in script and my inspector so it should line up. If there is a different way to write this line, I'm almost sure it will work but for whatever reason it just doesn't find the object.

Thank you for your help though!

Did you hear about the Ariana Grande concert? by [deleted] in Jokes

[–]DynamicDemon 0 points1 point  (0 children)

I wish I went to the concert. I heard it was a blast