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 DA_ATeam · Nov 29, 2011 at 09:39 AM · inputstringparsehighscore

Highscores Input wrong Format Error

Hello Unity Answers! I made my way through setting up Highscores Leaderboard, but when fill in the name and score and submit, I get the following error; Exception: Input string was not in the correct format System.Int32.Parse (System.String s. I have not edited or modified the code. When I hit run it displays a blank leaderboad with Name, Score and Post Score at the top.

 GUI.skin = Skin;
     
     windowRect = GUI.Window(0, windowRect, DoMyWindow, WindowTitel);
 
     name = GUI.TextField (new Rect (Screen.width / 2 - 160, 10, 100, 20), name, maxNameLength);
     score = GUI.TextField (new Rect (Screen.width / 2 - 50, 10, 100, 20), score, 25);
     
     if (GUI.Button(new Rect(Screen.width / 2 + 60, 10, 90, 20),"Post Score"))
     {
         StartCoroutine(PostScore(name, int.Parse(score)));
            name = "";
            score = "";
     }    
 }

The 6th line is the culprit. I've tried adding the name and score in, "", I've tried them both without quotation marks, I've removed the name and score 'labels' and put items in empty text boxes with and without quotations. I've also tried upper and lowercase combinations. I also tried single quotes as a last resort to no good result.Since I didn't change anything, or it's not explained how to format it I can't figure out what is the problem. Can some1 please tell me what condition my condition is in? Help?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by SomeRandomGuy · Nov 29, 2011 at 02:13 PM

Just a thought, but it looks like you are giving you are assigning textfields to a variable calles score, then using that variable inside the textfield and try to print that textfield. Might want to try to rename those variables name and score to namefield and scorefield or something.

I'm not that experienced with unity yet, so I might have just misunderstood your code, but that is what it looks like to me, and it would explain why it is a wrong format error. Good luck!^^;

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 DA_ATeam · Nov 30, 2011 at 05:09 AM 0
Share

@JustSomeRandomDutchGuy Thanks! I don't think it's a Unity problem. I did forget to mention it is a C# script. I know less about C# than the bit I've learned about JavaScript. Changing the name of those variables did not work. Thanks again! An 'A' for Effort!

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Taking data from text file 2 Answers

Currency String Format 1 Answer

C# inputString mouse Keys? 1 Answer

Shot Counter Question 2 Answers

High Score Name entry 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