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 PleaseHelpMe · Aug 10, 2013 at 11:42 PM · saveinventoryinventory systemserialize

Saving My Inventory

Hi guys, I'm neither completely newbie, nor professional.

Here I got a class:

 public class Item{
     public Texture2D texture;
     public string name;
     public GameObject[] gameObjects;
     public Transform prefab;
     public float req_gold;
     public bool  owned;
     public bool  merchant;
     public string slot;
     public string type;
 }

and I use

 public Item[] items;
 
 public Item[] bag_items;

this lines to create my inventory and my bag. (Player can only use items which are in bag)

so then, Can you tell me how can I store my inventory data? (I could save them between scenes, I add don't destroy on load to object, But when I open inventory I can't change item's place )

If you'll suggest "serializing", please explain it how I do it?

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

4 Replies

· Add your reply
  • Sort: 
avatar image
-1

Answer by lancer · Aug 12, 2013 at 09:44 PM

http://whydoit.com/ has an amazing, easy to use Serializer. I'm starting to use it a lot.

Comment
Add comment · Show 3 · 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 Narv · Aug 13, 2013 at 12:07 AM 0
Share

This is an under construction link...

avatar image Bunny83 · Aug 13, 2013 at 12:35 AM 0
Share

It's because his name (and domain name) is http://whydoidoit.com

@Narv: please don't start a downvote-fight with lancer.

avatar image PleaseHelpMe · Aug 14, 2013 at 09:15 AM 0
Share

Thank you guys, all of you. You saved me :)

avatar image
0

Answer by cdrandin · Aug 10, 2013 at 11:44 PM

check out http://answers.unity3d.com/questions/182491/remembering-variables-between-scenes.html

Couple of ways of achieving this.

Comment
Add comment · Show 3 · 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 PleaseHelpMe · Aug 10, 2013 at 11:50 PM 0
Share

Thank you, but as I told, I have problem with "don't destroy on load". And I want to "store" it. When I close the game and open it again, my inventory wouldn't be changed.

avatar image cdrandin · Aug 10, 2013 at 11:55 PM 0
Share

$$anonymous$$ight prove helpful. X$$anonymous$$L serialization. Store data onto a file, then when the file exist you ins$$anonymous$$d read from that. http://wiki.unity3d.com/index.php?title=Saving_and_Loading_Data:_XmlSerializer

What is Serialization?

avatar image PleaseHelpMe · Aug 11, 2013 at 09:52 AM 0
Share

Thank you. I'll save gameobjects name on xml and load them with name.

avatar image
0

Answer by TimBorquez · Aug 13, 2013 at 12:33 AM

i use static variables to use them in between scenes and playerprefs to save them

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
0

Answer by sholom1 · Mar 24, 2017 at 07:51 PM

i have a one scene game besides the menu. why not have a list and save the scene? will that not save the list?

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

18 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

Related Questions

Inventory and Merchant Script problems C# 0 Answers

adding inventory items is half-working 0 Answers

Making Inventory System Work for Multiple Food Types 1 Answer

Object Reference Not Set To An Instance of An Object Error 1 Answer

How to make a advanced inventory system? 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