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 redmotion_games · Sep 02, 2013 at 12:17 AM · arraysdatabasestartupglobal variables

Good Setup for Predefined Array Data?

Just wondering what the best set up is for arrays that will remain unchanged and be read by code during runtime.

I was considering XML for things like names of objects, dialogue, etc, but is there a preferred alternative as Unity doesn't seem to parse XML out of the box? For example, putting a script on a game object in the first scene which defines the arrays inside void Start?

Monodevelop seems to offer database setup and creation, can these be used with Unity quite easily?

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 fherbst · Sep 02, 2013 at 12:18 AM 0
Share

What's your usecase? Arrays are different than databases are different than permanent storage are different than runtime generated lists.

avatar image getyour411 · Sep 02, 2013 at 12:22 AM 0
Share

expanding on the X$$anonymous$$L, there might not be an 'Add X$$anonymous$$L' game component in the drop down, but the methods are there.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by DaveA · Sep 02, 2013 at 12:43 AM

It depends on what you want. If you want easy to code, CSV is pretty easy. XML is not hard either and you have several XML classes/libraries available. In both cases, you're reading text from a file (or via WWW) and if you're not worried (or if you in fact depend) on that data changing (like hacked) then that's fine.

If you want to 'bake' it into the game, what I've done in these cases is the same as the above, but make it an Editor script which reads the data into the structures on the desired component(s), and just Save Scene. Then you can see it in the Inspector to make sure it looks right, but you don't have to ship those text files.

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 redmotion_games · Sep 02, 2013 at 10:07 AM 0
Share

Thanks for the replies, the baking concept seems like a good way to embed the data into the final build, but it will constantly change during development so it's "exposure" isn't a big deal for me in the initial stages.

Data would be parts of names and objects and their properties - they would act as a pool of things to be combined at runtime using fixed random number lists, generating hundreds of potential combinations of character and object names.

From some initial tinkering it seems that when Unity starts, it loads the first scene in the build settings dialog, and the code to do the initialization would need to be attached to a game-object in the first scene.

I'm just wondering what the best approach to accessing these elements across multiple scenes. I was kind of hoping to break the games principle screens into separate scenes.

I suppose the code with the data and for dealing with it could be instanced in each scene with no problem?

Thanks again.

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

How to Integrate a .JSON text array into the program? 1 Answer

Best way to store and access info in long txt files? 0 Answers

Is this considered bad coding 1 Answer

Develope Cloud & Vuforia application 1 Answer

Read/Write attachments from MS AccessDB 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