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 /
This question was closed Apr 30, 2013 at 09:33 AM by Fattie for the following reason:

Duplicate Question

avatar image
-1
Question by xNewbic · Apr 30, 2013 at 07:25 AM · playerscenesaveload

Load and Save Scenes with PlayerPrefs.Set/GetInt

Hello. That i am trying to do is

When i win at 1 scene, i want to save it,

after if i close the PlayMode(Or my game) i want make it to Make Load Scene like Games saving the scene and if you want to continue the last Scene just select The scene and play. For Example :

I have 3 Scenes.

MainMenu Level1 Level2

I am start the game and i haven't play this game again to my Pc. i am pressing New Game I am playing Level1 scene and when i win (with an winnerScript) i set it to make PlayerPrefs save the last map i played.;

After i set it to go me at Level2 Scene. When i Finish i make it to Save data again.

that i want to fix are at main menu make the Scenes i had play and i can play Right now.

my Scripts(JavaScript) are as following: MainMenu:

 private function loadProfFunc(id : int) {
     if(PlayerPrefs.GetInt("Test", mapLevel) == 0) {
         if(GUILayout.TextArea("You haven't Start Any Level."));
     }
    
     if(numberLoad == 1) {
         if(PlayerPrefs.GetInt("Test",generalLevels.mapLevel) == 1) {
         
             generalLevels.mapLevel = 1;
             Application.LoadLevel(1);
         }
     }
 }


generalLevels:

 // This Code are to give the map a ID
 public static var mapLevel = 0;


winnerPlayer:

 function OnTriggerEnter(winner : Collider) {
     if(winner.tag == "Player") {
         generalLevels.mapLevel = generalLevels.mapLevel + 1;
         PlayerPrefs.SetInt("Test", generalLevels.mapLevel);
 
     }
 }


That was all my Scripts(a part of Them)

How can i fix it? If there any problem what must to do? Is this way true for that i am trying to do? if no what way is better and how can i do it? If already exist a answer like this (just send me the link)

thank you for read me!

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 Fattie · Apr 30, 2013 at 09:25 AM 0
Share

look at "Unity Serializer" everyone uses it, search

Also just FWIW, a detail. PlayerPrefs is not secure, so largely useless for real games.

I've taken to using "Secured PlayerPrefs" from the Asset Store. It's pretty good.

avatar image Benproductions1 · Apr 30, 2013 at 09:27 AM 0
Share

This has been asked too many times before. Here is a link: http://lmgtfy.com/?q=unity+load+save+scene Because I decide to be nice :)

avatar image Fattie · Apr 30, 2013 at 09:33 AM 0
Share

Good point Ben if you do have the karma to close a question, just do so for sure

avatar image Benproductions1 · Apr 30, 2013 at 09:39 AM 0
Share

@Fattie If only.... if only...

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

15 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

Related Questions

carrying player data from one scene to the next 1 Answer

how to save a load a game? 1 Answer

Save game support, how do I load audio in a sertain time frame? 0 Answers

Save/Load/New 1 Answer

How do I open a PC project/scene on MAC? 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