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 DrZarqawi · Apr 13, 2013 at 01:10 PM · xmlread

Using XML for a simple webplayer Highscore Table

Hi, i've been searching around the interweb for days now trying to figure out XML read/write routines. I've made a simple Pinball Game and exported it as a webplayer application, but i need a Highscore Table. At first i thought a database would be the best approach. But for some reason ever since i heard of databases a few years ago, everytime i try to understand databases my brain shuts down. So Saving/loading the scores from a read/write file seems better for me.

i'm thinking my XML would look something like:

 <1stName>RandomName1</1stName>
 <1stScore>123</1stScore>
 <2ndName>RandomName2</2ndName>
 <2ndScore>213</2ndScore>


... and so forth...

now to my question: how do i get the values from the different XML elements assinged to variables and how do i overwrite the old values with the updated variables i get from playing?

it seems rather easy but for some reason i cant wrap my brain around it.

Thanks in advance! :)

EDIT: I use UnityScript (JavaScript) By The Way

Comment
Add comment · Show 3
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 Graham-Dunnett ♦♦ · Apr 13, 2013 at 03:27 PM 0
Share

Why do you need to save in xml format? Why not just save the data line by line. Or use playerprefs. If you have to use xml, use google, and search for "unity xml" and I guarantee you'll find thousands of hits.

avatar image DrZarqawi · Apr 14, 2013 at 09:57 AM 0
Share

How do I save the data line by line and in what format then? And what is playerprefs? And how do I use that? X$$anonymous$$L just seemed like the only real way for me to go. I used the exact search terms "unity xml" and yes I found 2-3 hits although in these tutorials they do all sorts checks and advanced routines which covers up the point for me. If there is an easier way, I would definitely use that way. Because the biggest part of my game will nnot be highscore depending.

avatar image DrZarqawi · Apr 15, 2013 at 04:56 PM 0
Share

Well i tried PlayerPrefs which seemed to work fine, until i deployed my game and found that, as the name states, PlayerPrefs are player specific. which means people still cant compete for highscore. That leaves me with two choices line-by-line in a text file or X$$anonymous$$L as i first stated.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Graham-Dunnett · Apr 14, 2013 at 01:38 PM

  1. Visit Google

  2. Enter "unity write text file"

  3. Press search button.

  4. Click first hit (or visit http://answers.unity3d.com/questions/23578/how-do-i-write-a-line-of-text-to-a-file.html directly.)

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 DrZarqawi · Aug 10, 2016 at 02:08 PM 0
Share

But this only solves half the problem, it allows me to write to text file but not to read and convert data to variables from textfile... I've since found that for my purposes Read/Write of a textfile wouldn't have worked anyways... but thanks for trying atleast :)

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

12 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

Related Questions

Work with XML hidden for the user? 1 Answer

Write and Read to a iOS device! Help 1 Answer

Saving My World 1 Answer

How to make/write to files, then read immediately? 1 Answer

XmlException when trying to read/write XML from iOS device 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