Brackeys Inventory System C# (FIXED)

Updated on April 14, 2017 in  [R] Scripts
Share on Facebook0Tweet about this on Twitter0Share on Google+0Share on Reddit0
54 on June 17, 2015

Hey all, I needed an inventory system and since i code C# I fixed the one from Brackeys to work.
Credit for this fix goes to me, credit for the system of course goes to the original!
Download
feel free to scan it or w/e if you feel its necessary :)

Note: If it says anythings missing just let me know; i may have added stuff into it that I’ve forgotten about

  • Liked by
Reply
0 on June 18, 2015

Great work ! When I try to import your inventory I have a error :

"Assets/C# inventory/Inventory/Scripts/Other/QuestItem.cs(5,16): error CS0246: The type or namespace name `QuestHandler' could not be found. Are you missing a using directive or an assembly reference? "

There is no possibility to install the inventory as Brackeys does in js ? ( ctrl+i if i remember) 

 

Thank’s

  • Liked by
Reply
Cancel
0 on June 18, 2015

Oh sorry I think I’ve left a reference to my quests script in there!
I’ll have to clean it up tomorrow and re-upload!

  • Liked by
Reply
Cancel
1 on June 18, 2015

Hey, nice work! I don’t use that system so I don’t know much about it, but I do see a lot of people having problems with it. Post the re-upload here so, when you do, I can pin it to the top of the forum for a while 😉

Devoted
on June 19, 2015

Okay, I have created a test scene and fixed everything.
As you may or may not know, Unity 5 removed the Character Controller asset pack, so I’ve included that too (as it’s required for the MouseLook component)
If it’s going to be pinned, do you mind testing it first? If not, im sure people will let me know if it mucks around!
Download

Show more replies
  • Liked by
Reply
Cancel
2 on July 6, 2015

Well done! I’ve taken down the old unofficial C# release (it had its issues). Instead I’ve provided a link to this thread from the download page. Check it out here.

Guru
on July 6, 2015

Nice!

Devoted
on July 7, 2015

Thanks!
Any errors should be posted here so i can quickly fix them and re-upload

Show more replies
  • Liked by
Reply
Cancel
6 on September 13, 2015

Hey when you fill your inventory with items and you drop them i cannot pick them up again any idea why is that ?

Devoted
on September 14, 2015

Post any error code here.
I’ll try and replicate it, and will upload if I can do so.
If I can’t replicate it, then it’s likely to do with your game not the inventory

on September 14, 2015

If i try to pick more items than i have slots in my inventory i get this error:

ArgumentException: Destination array was not long enough. Check destIndex and length, and the array’s lower bounds
System.Array.Copy (System.Array sourceArray, Int32 sourceIndex, System.Array destinationArray, Int32 destinationIndex, Int32 length) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Array.cs:1019)
System.Array.Copy (System.Array sourceArray, System.Array destinationArray, Int32 length) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Array.cs:936)
System.Collections.ArrayList.CopyTo (System.Array array) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections/ArrayList.cs:3053)
Inventory.AddItem (UnityEngine.Transform Item) (at Assets/Inventory/Scripts/Inventory.cs:47)
Item.PickUpItem () (at Assets/Inventory/Scripts/Items/Item.cs:107)
Item.OnMouseDown () (at Assets/Inventory/Scripts/Items/Item.cs:65)
UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32)

on September 14, 2015

That error only occurs if i try to overfill the inventory. The main problem is that 8/10 times the items i drop cannot be picked up again and i get no error message or debug log about it.
Quick Edit: The items i am using aren’t different its the same item just 10 copies of it. I thought it was the item at first itself, but then i created another one and another one and if i get 6-8 same items in my inventory and i drop some i cant pick them up again.

Devoted
on September 15, 2015

This sounds like an error with the stacking system maybe? I did change that after I fixed this and haven’t uploaded it; I’m taking a break at the moment.
I’ll upload the version with the stack fix soon and you can tell me if anything changes

on September 15, 2015

Actually you are right i tried to make stackable items and i couldn’t. Thanks for your work and quick replies!

Devoted
on September 15, 2015

no problem! I’ve found the issue (i think) and i have fixed it. Items were not being deleted from the inventory properly and that has now been rectified.
Give me a minute to remove some code that’s related to my own game and I’ll upload it again and post the link

EDIT: I have noticed a bug to do with the inventory display wherein it will place the icon of the last picked up icon over the item in the first slot. you can still use the icons, except you cant choose which one to use. I’ll try and fix it soon

tl;dr:  picking up an item always places it in the first slot over the other one.

EDIT 2: I have fixed the issue, will upload soon

Show more replies
  • Liked by
Reply
Cancel
0 on September 15, 2015

done some fixes, here is the new version:
Download

  • Liked by
Reply
Cancel
4 on September 15, 2015

done some fixes, here is the new version:
Download

on September 15, 2015

ok so imported the new version and i got these 3 errors.

Assets/Inventory/Scripts/Inventory.cs(18,16): error CS0246: The type or namespace name `StorageDisplay’ could not be found. Are you missing a using directive or an assembly reference?

————————————————————————————————————

Assets/Inventory/Scripts/Inventory.cs(19,16): error CS0246: The type or namespace name `Storage’ could not be found. Are you missing a using directive or an assembly reference?

————————————————————————————————————

Assets/Inventory/Scripts/Items/ItemEffect.cs(8,16): error CS0246: The type or namespace name `ItemType’ could not be found. Are you missing a using directive or an assembly reference?

Devoted
on September 15, 2015

Weird, I swear I’d deleted that part of the script!
(In case you were wondering I’ve integrated my storage system into the inventory system, and my item types into the item script)
Will fix that tomorrow :)

on September 15, 2015

Ok man thanks once again i will wait for the update :)

Devoted
on September 30, 2015

bad news, i fucked up and formatted my hard drive which deleted not only my inventory but also my game that ive spent a year and a half on….

so yeah ill still try get this working aha but it might take a while as its coming up to exams

Show more replies
  • Liked by
Reply
Cancel
9 on September 15, 2015

Okay i’ve RE-redone it, removing those references.
Download

on September 15, 2015

Ok so i imported it to my game and i now i can’t even pick items. So i decided it was just problem with my game so i created a new project and imported the update and i still cant pick items and i get this error.

Assets/Inventory/Scripts/Other/InvPauseGame.cs(41,71): error CS0246: The type or namespace name `MouseLook’ could not be found. Are you missing a using directive or an assembly reference?

Devoted
on September 16, 2015

Hey, so I’ve just realised that this was created for an older version of unity, in which there were difference character controllers. If you like, I can upload the character controllers that there used to be (since I’m currently using them as I’m backdated aha)

on September 16, 2015

Well if that will fix the asset i am more than happy :) Does that mean i will have to tweak my game and adjust it to the older character controllers?

on September 16, 2015

I was also wondering if there is a way to make more visual equipment slots (not only for the weapon).

on September 16, 2015

Head, chest, boots, pants, gloves, and for each hand. I think you have to make more object holders and somehow map your character (just like setting up the weapon)

Devoted
on September 16, 2015

If you wanted the equipment to appear in game on the player you’d have to map it, yes.
If you just wanted it in the inventory slots then you could perhaps rename some of the slots, or yes create new ones.
That’s up to you though, I can’t change the c# version as that would mean it’s not a c# version anymore (since it’s different)
I may get it working with the new character controller.

Give me a few days please :)

on September 16, 2015

Ok thanks man i will wait for the update :)

on September 24, 2015

Hey man any progress on the asset ?

Devoted
on September 24, 2015

I’ve been swamped with uni projects, I’ll work on it as I can and upload when it’s done.
Feel free to keep reminding me just in case :)

Show more replies
  • Liked by
Reply
Cancel
4 on September 30, 2015

Hey, i have problem with unequip.. When i equip some items and when I try to remove one thing while others do not want.

I realized that they were shot in the slot and 1 if it is already occupied, the other it is not recorded.
I can not find in a script where the verification unit

on September 30, 2015

Also when we equip 1 item then size content -=1, but.. When we unequip some Item then size content = max content  (!)

on September 30, 2015
Devoted
on September 30, 2015

Interesting, i’ll look into that

on October 1, 2015

It seems to me to fix it …
Even though it looks terrible for a good programmer 😀

Show more replies
  • Liked by
Reply
Cancel
2 on October 5, 2015

Torione: I have updated the system to work with the new default First Person Controller (A script which handles mouse looking).
In the download i will include the test project so you can see how i have it set out.
Radonite: I believe i have also fixed your problem too.

Download (Most recent as of 5/10/2015)

Any more issues please post them and I’ll look into it.

Guru
on October 5, 2015

Very nice man! Your support for this download is awesome!

Devoted
on October 5, 2015

Thanks!
I’m trying to keep it as close to the original as possible, but it’s hard as much of its code contains non-functional API’s :/

Show more replies
  • Liked by
Reply
Cancel