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 7toni7 · Sep 22, 2013 at 05:12 PM · webplayerplayerprefs

PlayerPrefs - Error in webplayer

Hi all,

I am trying to store some data using PlayerPrefs, in order to be used in the following runnings of the app. Well, if I use PC standalone in windows, it works perfectly. Thus, The first time I run the application, Playerprefs stores the data; and the followings the stored data are loaded perfectly.

The problem is that, when I use the webplayer for doing the same. It seems like the data are stored correctly, but Playerprefs does not load the data as expected. The code is the following (both standalone windows and webplayer):

Code for storing the data:

 //Stores int
 int n = 10;
 PlayerPrefs.SetInt("selected_num",n);
 
 //Stores two strings    
 string cc = "10-20-30-40"; 
 PlayerPrefs.SetString("selected_for_classification",cc);
     
 string dd = "4-66-3;5-6-7"
 PlayerPrefs.SetString("selected_for_distances",dd);

Code for reading the data:

 //We read the stored information
 int n_readed = PlayerPrefs.GetInt("selected_num");
         
 string classif = PlayerPrefs.GetString("selected_for_classification");
         
 string distances =     PlayerPrefs.GetString("selected_for_distances");



The error in webplayer is like it does not read well the stored data. Do you know what is happening? Please, I need help :).

Thank you very much in advance

Comment
Add comment · Show 4
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 ♦♦ · Sep 22, 2013 at 06:53 PM 0
Share

The webplayer has a 1$$anonymous$$B limit on the data. You'd usually get an error when storing, though. Are you calling PlayerPref.Save?

avatar image 7toni7 · Sep 22, 2013 at 10:42 PM 0
Share

No, I'm not calling PlayerPref.Save... is it necessary? When should I call it? At the end of the code?

avatar image 7toni7 · Sep 23, 2013 at 07:06 AM 0
Share

please, I'd need your expertise :)

avatar image 7toni7 · Sep 23, 2013 at 07:49 AM 0
Share

I have to say that, I have two differents webplayer apps in a public dropbox folder (thus, two different url's).

First, the user runs the app1...it creates several random numbers and stores these numbers by using Playerprefs. Once the first app is finished and closed...the user runs the app2 (different url, but same PC) and this app2 attempts to read these previously stored values (by app1) in order to use them during the running...

Is my code correct for achieving this aim?

Best,

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Seizure · Sep 23, 2013 at 03:23 PM

That will not work 7toni7. PlayerPref's are based on each individual URL, you can not access them like that, what you'll need is a server side database that each of the different games talk to if you want to provide data across the platforms.

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 7toni7x · Sep 23, 2013 at 03:44 PM 0
Share

Thank you very much Seizure. Could you provide me further information about how to achieve this? I'm a little bit confused...

Best Antonio

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

Copy/Paste from WebPlayer or save as cookie 1 Answer

How many variables can I store using PlayerPrefs 1 Answer

PlayerPrefs when moving the webplayer 1 Answer

How can I view a webplayer playerprefs file? 2 Answers

playerprefs save date cheat problem 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