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
-1
Question by DubstepDragon · Dec 31, 2014 at 01:17 PM · inventoryrpgtxt

Inventory using a TXT file... Is it possible?

This is merely theorycrafting, but is it possible? Also, how would it be made ideally? I am very new to programming inventory systems and have not got much experience with Arrays and Lists. Ideally I would like it to have a limited amount of slots, equipping, a dictionary so only that item can be placed in that slot, stacking, consumables, etc... Would it be possible?

Thanks in advance! :D

NOTICE: Seeing as moderators might take this post down as they would normally do with people asking for scripts, this is not a begging post. I am gathering others' experience and opinions on the topic in order to begin working on it myself.

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 ExtremePowers · Dec 31, 2014 at 01:21 PM 0
Share

What do you mean with it, like saving an inventory as a .txt file?

Couldn't you do this with json, so define a inventory slot like this:

[ID(The ID of the given item),Amount(The amount of the item in that slot),Slot(The slot that this item is assigned to)]

avatar image Baste · Dec 31, 2014 at 03:37 PM 0
Share

Possible, and a horrible idea.

PlayerPrefs is where you want to go for simple storage of stuff.

2 Replies

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

Answer by HarshadK · Dec 31, 2014 at 01:28 PM

It is possible to do it using a TXT file although it will be a lot of headache since first you have create a format to store all your required data in that txt file and then write a parser to parse that data to load and save into the file. This is just a lot of work.

You can try using a pre-defined formats like XML or JSON since they will make your job easier since you just have to figure out how you should fit your data into that format and you have readymade parsers available for these formats.

Suppose you decide to use XML you will have a parent node for your inventories list which will contain all the inventory items as its child nodes with their attributes and values. You can then read the file and load this into a List and use in the game. While saving you can just put your items from List to the file.

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

Answer by haim96 · Dec 31, 2014 at 03:52 PM

or you can use local database for example this free solution from the asset store:

https://www.assetstore.unity3d.com/en/#!/content/20660

didn't check it my self but it should work.

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

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

28 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

Performance with 100+ CharacterController's 1 Answer

Multiplayer in Action RPG, best approach? 2 Answers

100 animated enemies == 400 draw calls? 1 Answer

audio not playing when i destroy gameobject or setactive to false,audio not playing when i destroy gameobject or setactive into false 1 Answer


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