Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Koder · Apr 01, 2011 at 01:20 AM · inventoryitemstackable

Stackable Inventory Item

I did a quick search on google/unityanswers and found nothing so I figured I'd post it here. I have an inventory mostly working now, but if I wanted a certain object to be able to hold more than 1 per slot, what would I need to do? Thanks. Oh, and if you are to do some code, JS would be preferable.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Bunny83 · Apr 01, 2011 at 02:00 AM 0
Share

We have no idea how your system works so how should we "extend" yours? There are millions of ways to create an inventory system, so can you go a bit more in detail? $$anonymous$$aybe add some of your code you already have? You can edit your question at any time.

avatar image Koder · Apr 01, 2011 at 02:10 AM 0
Share

Ah yes sorry, I was just looking for a general answer I suppose, but I do realize it limits the resulting answers, and will add some code next time if I have troubles with @Justin Warner 's suggestion.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Justin Warner · Apr 01, 2011 at 02:01 AM

When you pick up an object you already have one of... Just increment the "amount of," and change the graphics to "multiple __"... Just keep it as a static variable...

Example, apple.

Player inventories an apple. apple++. Change graphic of apple to apples. Then on hover, add a tooltip so that it shows "Apples "+ apple (apply being the amount of apples var).

Does this make sense?

Comment
Add comment · Show 9 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Koder · Apr 01, 2011 at 02:07 AM 0
Share

Yes actually, and how hard would it be to add the number of apples to the graphic rather than having to hover over it?

avatar image Koder · Apr 01, 2011 at 02:22 AM 1
Share

Sorry never $$anonymous$$d, I figured that much out, leave the easy part to me eh? I just did a GUI.Label and put the variable as the string and output it down and to the right of where my inventory draws the item and it works.

avatar image Justin Warner · Apr 01, 2011 at 02:27 AM 0
Share

Yes, exactly, =), +1 =P. But glad it helped =).

avatar image Koder · Apr 01, 2011 at 03:37 AM 0
Share

Alright, hey again Justin. I was wondering if you knew a way around this. I got the stack thing working just fine, however, the way I programmed it, it can only have a single stack of a single item, (example: 50 gold) when I want to have multiple stacks of a single item (example: 5 stacks of 50 gold). Would you know a way around this?

avatar image Koder · Apr 01, 2011 at 04:48 AM 0
Share

Actually, never$$anonymous$$d. I don't see the point in limiting people on the things I wish to make stackable, I'm not a hater like that. I'll just set a high limit & make it so there can only be one stack:)

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Help making premade Items for farming game 2 Answers

Problem with dropping items from my inventory 0 Answers

A question about creating items using scriptable objects 1 Answer

Managing Item Types 1 Answer

Hey, i can't figure out, what my problem is. I want to Add something into the player's Inventory, but before that it should check, whether there is an Item with the same name in it, or not and if yes, if the maxAmount for that slot is reached. 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges