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 Bananaman · Feb 05, 2013 at 10:26 PM · rotationsavingpositon

Why won't my Player load with the correct position and rotation on my android device, but it will on my computer?

So I'm having a problem with the loading of my players position and rotation. I'm using player prefs to save the information as floats. I can Debug.Log() the values and it shows up just fine. However when i build the game out, it does not work... It just send me back to the beginning of the level with 0 rotation as it should when a new game is started. What is happening and how can I fix it?

Here's some snippets of code to help you guys understand what is going on.

 Keep in mind none of this has actual variables, it's just for the idea.
 
 
 // saving the value(each value for position is saved as individual "X" "Y" and "Z"
 PlayerPrefs.SetFloat(name, value);
 
 // when loading game, making variable equal to value
 variable = PlayerPrefs.SetFloat(name, value);
 
 // Setting players position to the value
 
 player.transform.position.x = variable;
 
 // for rotation 
 
 player.transform.eulerAngles.y = variable;
Comment
Add comment · Show 1
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 Bananaman · Feb 07, 2013 at 01:32 AM 0
Share

Anyone got an idea? :)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by OWiz · Feb 07, 2013 at 02:49 AM

When you push a new build out to your Android, it deletes whatever old PlayerPrefs you have in there. If you'd play around on the android device, save it, and then load it up, you'd probably find that it loads correctly.

Or if it doesn't load at all, then it might not correctly save or load playerprefs, perhaps because you have the location hard-coded to a point on your computer, which your Android obviously cannot find.

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 Bananaman · Feb 07, 2013 at 09:24 PM 0
Share

Ok so here's the strange part, some of the other player prefs ARE saving so it really doesn't make any sense as to why these are not. I will give the entire code when I get home, but if you have any other suggestions, that would be great :)

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

11 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

Related Questions

How to save players rotation in Unity? PlayerPrefs 3 Answers

Flip over an object (smooth transition) 3 Answers

Character rotating to previous rotation 1 Answer

Having difficulty with Parent Object rotation and Child Object movement. 0 Answers

Rotating gameObjects gives me completely inaccurate values at runtime 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