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
2
Question by thellama · Jul 20, 2012 at 06:18 PM · editordatabaseinventoryitemstorage

Custom Editor Window to Create and Store Item Data

I want to create an Editor Window that I can use to Create, Store, Display and Edit Items for my game. Sort of like an Item Database Window.

My question is: Is what is the theory behind setting something like this up? Should I be writing all this information from this Editor Window into a txt files and calling it out at runtime into a Dictionary or List for use in the game?

I can write the editor window that's not the issue. I just need to know how to store the data for use later. What are some approaches I could take?

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 BigRoy · Feb 10, 2014 at 08:58 PM 0
Share

Were you able to create the custom editor for this particular problem. If so, are you willing to elaborate some more on the code involved?

avatar image thellama · Feb 10, 2014 at 09:36 PM 2
Share

Basically you create a ScriptableObject class that contains arrays of all your object data. Then populate that with an editor script that adds new entries into the arrays. Then when you done you have a save function that saves out the asset. That asset can then be loaded from any script and read for data.

I ended up using external files that I fill with data and have the game read on start up. This way I can format and edit anyway I need. It turned out to be much easier for the time being and require less changes as I iterate.

Here is a good topic on it all: http://ivanozanchetta.com/gamedev/unity3d/unity-serialization-behind-scriptableobject/

1 Reply

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

Answer by whydoidoit · Jul 20, 2012 at 06:21 PM

You could create a class from ScriptableObject and store it as an asset, that's probably the most elegant way. Then you can use the inspector to assign the data as well.

Comment
Add comment · Show 4 · 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 whydoidoit · Jul 20, 2012 at 06:22 PM 0
Share

See this article on creating assets.

avatar image thellama · Jul 20, 2012 at 06:36 PM 0
Share

Thank you. Would I be correct to assume this generated asset would act like a prepopulated class containing all the item information as if I had done it all by hand in the script editor?

avatar image whydoidoit · Jul 20, 2012 at 06:37 PM 0
Share

Yes, it becomes an asset so when you've configured it the data will be saved.

avatar image thellama · Jul 20, 2012 at 07:42 PM 0
Share

This answer is just what I was looking for!

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

6 People are following this question.

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

Related Questions

Good way to store Items in a mySQL database? 2 Answers

How do I retrieve an item from a list? 1 Answer

Item Database 3 Answers

Store item images in database or on device? 0 Answers

DontDestroyOnLoad make errors 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