• 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 Gilead7 · May 18, 2015 at 11:44 PM · c#assetdatabase

Asset Database and Inventory System

I've been watching many tutorials on creating an asset database and inventory system. I've about decided to make a custom editor script. My original idea was to have one massive list of items so that I can make random loot based on the a random number or have a specific item generated. The question comes should I have one massive list or break it up into specific items. One db list for armor, one for weapons since each will have a different set of attributes. I have a base item script with: id, name, description, value, weight, and a texture 2d for the icon.

Some things like weapons will have prefabs so you can see and use them once equipped. Armor needs a texture so you can apply it to a model body in the inventory. Any help would be appreciated. Also planning random encounters with a mob list. Thanks!

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Slider_j · May 19, 2015 at 10:13 AM

I think it depends upon how you wish to structure your game and how many items you want to have in your game. it's a bit of an open question. Personally, i prefer a bit of semi-randomness maybe have each mob maybe drop 1 or 2 items from a list of (for example) 10-20 different loot objects. so a guard may drop a sword or a shield or a health potion or some papers or whatever but would never drop a blanket or a bunch of flowers, where as a farm-hand may drop the blanket or flowers but never drop a shield....

for ease i would probably go with one big list of items, with a number of attributes for each item. and have something like a string for the item name, an int for a unique identifier number, another string for a path to the item icon, an item type enum. then a number of ints /floats/strings etc after. these trailing vaules can be assigned totally different uses depending on what the value of the item type is. for example the first int after the item type could be used to store a power value if it's a weapon, if it's armour that same int could be used to store defence, if its a potion then the number could be used to dictate what the magical value of the potion is (0 = health, 1 = magic)

Comment
Add comment · Show 1 · 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 Mike-Geig ♦♦ · May 20, 2015 at 02:52 PM 1
Share

Also depends on whether or not your items are fixed or randomly deter$$anonymous$$ed. I'd say that more than likely, you will just need one db table for your items.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Prevent changes in ScriptableObject type Asset in Editor. Dont save it. 0 Answers

Using Hidden folders for editor stuff? 1 Answer

AssetDatabase.Refresh() no longer recompiling my generated scripts 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