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 Tyler 2 · Dec 19, 2010 at 12:32 AM · playerprefsbce0018bce0017

Scripting error

Hello. I got this script this thread that I started. I am trying to use it to control the highscores in my game, but I keep getting this error ""Assets/NewBehaviourScript.js(3,19): BCE0018: The name 'string' does not denote a valid type ('not found'). Did you mean 'System.Runtime.CompilerServices.StrongBox'?" " what is wrong? Thanks

function Update () {
    var key : string = System.String.Format("{0}{1}{2}_score", Arcade.ModeInt, Arcade.DifficultyInt, Arcade.CharacterInt);
PlayerPrefs.SetString(key, Stats.Score);
}
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 Eric5h5 · Dec 19, 2010 at 12:47 AM 0
Share

Like the error said, 'string' is not a valid type. You can use 'String', or leave it out...System.String stuff all returns a String, naturally, so 'key' is always a String anyway. LOL @ the suggested replacement though.

avatar image Statement · Dec 19, 2010 at 01:33 AM 0
Share

StrongBox it is ;) J/$$anonymous$$

1 Reply

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

Answer by uhahaha · Dec 19, 2010 at 12:44 AM

string -> String

Comment
Add comment · Show 2 · 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 Tyler 2 · Dec 19, 2010 at 01:04 AM 0
Share

heh, thanks. I fixed that and I get this error "Assets/NewBehaviourScript.js(3,30): BCE0017: The best overload for the method 'UnityEngine.PlayerPrefs.SetString(String, String)' is not compatible with the argument list '(String, int)'."

avatar image Statement · Dec 19, 2010 at 01:37 AM 0
Share

Thats because you want to set a string (You call SetString) but pass in an integer (Stats.Score is an integer). What you probably want to do is call SetInt ins$$anonymous$$d of SetString. Another option (I doubt you want to do this though:) is to convert the int to a string; Stats.Score.ToString().

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

No one has followed this question yet.

Related Questions

Number of played games 1 Answer

Get PlayerPrefs file path directly at runtime? 0 Answers

I can't save my money? :< 1 Answer

PlayerPrefs not storing string? 0 Answers

Can you load a level through using PlayerPrefs? 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