My Contribution - Inventory System - Free

Hello everyone, I’m Eddy.

I’ve worked on a few games on unity and posted them so some of you may have seen my work in progresses! But anyways, I wanted to make a small contribution to the Unity3d community. So here you go!

Webplayer:
https://dl.dropbox.com/u/6629353/InventorySystem.html

Since I’ve noticed a lot of people wanting to work on games but not knowing any scripting, I decided to make a very basic, and by basic I mean really really simple inventory system.

This is heavily commented.

This is mainly aimed at people learning unitys JS. It may not be perfect, or pretty but it works :P.

Source:
http://dl.dropbox.com/u/6629353/InventorySystem.zip

Use this however you want :P.

If you’re looking for a fully customizable inventory system with a lot of great features I highly recommend you check this out:

Good Luck fellow developers! :).

Be sure to check out these threads:
Advanced Inventory Equipment System
Simple Inventory - Free
Simple Health Bar - Free

Thanks but how would you make it so you can delete objects? Please reply!

Okay I updated it with the ability to remove items from your inventory by clicking them, Hopefully this achieved what you needed done :). To literally destroy something, Remove the item from the list the same way i did when moving it to the ground but instead use Destroy(gameObject); That would most likely do it.

Let me know if anything works incorrectly or needs to be fixed.

To make this very interesting script even more interesting you could perhaps make different items that can be assigned to the player.

like picking up an armor piece can only be assigned in the armor slot.
and that armor piece would be assigned to the player model.
(easiest would be to give the player model a skeleton, and rig the armor piece to the same skeleton, but save it as a separate model)

I’m sure people would be willing to pay for that, even more then $5 i know i would :slight_smile:

Awesome - Yeah, and I could call this the Indie version, And that the Full version. I think I will deffinetly make a pimped out version of this. An update will probley be ready in a few days so keep a look out.

@Xeno360, if you need any help with some art assets. let me know. i’d be happy to help you out.
items/characters/rigging

Hey guys, Wanted to let everyone know i havn’t forgotten about this! :P. Im working on an “Advanced System”, that will be released shortly (day or so hopefully).

This is looking pretty cool. The biggest problem I’ve found in creating an inventory system is coming up with a good way to save and load that inventory between game sessions. Would love to see your take on that.

Well, Ive actually just finished the inventory system and am waiting for it to be uploaded for a release. But, To take care of that problem wouldnt be to hard. Just recreate the inventory each time you load a game.

Ex:

Set up a list of items that could possibly be collected while playing.

Then at the end of the game session use player prefs to store some integers

item 1=4;
item 2=1;

etc. And then just have it re-create the invnetory with the saved int’s when loading

Inventory.Add(availibleitems[item1]) and so on.

Thats how id do it at-least. :stuck_out_tongue:

How to change the Back Drop to a GUI Box

Just remove the existing line of code that sets the background image, and use a GUI.Box instead. e.g.

GUI.Box(Rect(0,0,640,480), "Inventory");
1 Like

Yeah! What he said! ^.^

1 Like

nice man :smile:
this saves me about 10$

can you make a script that the people can equip the armor? to the character??
that would be nice :smile:

He already has that done with the advanced version. Well worth the money.

http://forum.unity3d.com/viewtopic.php?t=57849

Hey you can make me some scripts :), i need:

With a quote of how complex i think they are next to the names.

Phaser’s from Star Trek ($5)
Torpedos ($1)
Targetting System ($4)
Shields ($3)
Damage ($3)
Pulse disruptors ($1)

is there a way to extend this for point and click style inv, it goes into your inv, but i want to select a item to use it so then i can use code such as

if item selected == spade and in hole trigger

dig

somthing like that

@Xeno360 - have you tried this out in Unity3 at all? I’m trying to get it working but running into issues within the following code:

var Contents : GameObject[];

function AddItem(Item : GameObject) {
	var newContents = new Array(Contents);
	newContents.Add(Item);
	Contents = newContents.ToBuiltin(GameObject);
}

This produces an error:

(on the final Contents = … line)

Used to work fine in Unity iPhone 1.7. Seems to be a lot of these casting/typing changes in Unity3.

Thats odd >.<. I Dont have Unity3 yet, But when I get my hands on a copy and figure out what the changes are and what not I’ll update this :). Sorry about that.

Hmmm… I booted it up in unity 3, and it runs fine for me. No errors at all. Only thing I noticed different while using it with unity 3, is when dropping the boxes. You can get stuck inside its collider now >.<, (I guess colliders work while inside and out now? :stuck_out_tongue: ). Maybe if you redownload the package and re-compile it in unity 3 it will work.

-Eddy

Thanks for checking. Which build platform are you set to when testing?

I’m finding a lot of my Unity iPhone stuff isn’t working anymore in Unity 3, but seems to work for other people. I’m wondering if it’s something specific to setting Unity 3 to the iPhone build platform, or maybe some specific setting I have turned on.