Saving & Loading a BASIC level in Unity [PlayerPrefs C#]

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 พ.ย. 2024

ความคิดเห็น • 76

  • @SpeedTutor
    @SpeedTutor  3 ปีที่แล้ว +1

    Do give me any suggestions for upcoming videos you'd like to see! I hope everyone is safe and well! :)
    Patreon: www.patreon.com/SpeedTutor
    Join the Community Discord: discord.gg/vnhWy6R
    Check out my FREE Assets here: bit.ly/381ybzt

    • @toiletpaper3346
      @toiletpaper3346 3 ปีที่แล้ว

      hiiii im 12 i learn so much from your tutors in unity im a content creator in training thanksnto you ;))

  • @seanstanley2744
    @seanstanley2744 ปีที่แล้ว +2

    As a noob I found the other tutorials on this subject totally mystifying. Thanks to this tutorial, I have a simple working save system in my game. Thank you!!!

    • @SpeedTutor
      @SpeedTutor  ปีที่แล้ว

      I learn in a very particular myself and find it easy to break the idea down into exactly what you'd actually use without any extra fluff. I'm glad you found this useful! Good luck with your game! :)

  • @prosealien
    @prosealien ปีที่แล้ว +1

    Thanks this is so well explained & the best tutorial I have seen in ages. I now have a great save system even added a clear save option too.

    • @SpeedTutor
      @SpeedTutor  ปีที่แล้ว

      Oh amazing, thanks for checking this out! :) How did you find me? :)

    • @prosealien
      @prosealien ปีที่แล้ว +1

      I was looking up Unity save methods

    • @SpeedTutor
      @SpeedTutor  ปีที่แล้ว

      Awesome, good luck! :)

    • @prosealien
      @prosealien 4 หลายเดือนก่อน

      Just to add after creating a build the 1st level for some reason automatically becomes saved even if I reset before build, is there a way around this?

  • @danstastudios2602
    @danstastudios2602 2 ปีที่แล้ว +1

    Thank you so much! This is by FAR the best tutorial I have seen - it really works!! Thanks!

    • @SpeedTutor
      @SpeedTutor  2 ปีที่แล้ว +1

      Amazing! Thanks for checking this out! :D

  • @VonSebastianTalk
    @VonSebastianTalk 2 ปีที่แล้ว +1

    thanks, this seems a lot more approachable than those tutorials that last over an hour 😄

    • @SpeedTutor
      @SpeedTutor  2 ปีที่แล้ว +1

      Haha, I'm glad you think so! :D Hope to see you again, my friend!

  • @MinecraftKid2017
    @MinecraftKid2017 2 ปีที่แล้ว +2

    very cool tutorial im planing to make another big project that is not a runner and saving system is very needed.
    wish me luck!

    • @SpeedTutor
      @SpeedTutor  2 ปีที่แล้ว +1

      Haha, best of luck my dude! I believe in you.

  • @sajibislam337
    @sajibislam337 ปีที่แล้ว +1

    thanks, worked and learned how to use it.

    • @SpeedTutor
      @SpeedTutor  ปีที่แล้ว

      I'm glad you found it useful! :)

  • @toiletpaper3346
    @toiletpaper3346 3 ปีที่แล้ว +2

    i never clicked so fast beforw

  • @chxse4999
    @chxse4999 2 ปีที่แล้ว +2

    Bro thank you so much

    • @SpeedTutor
      @SpeedTutor  2 ปีที่แล้ว

      That's no problem at all, my friend! I'm glad I could be of service! :D

  • @davidrogers6987
    @davidrogers6987 3 ปีที่แล้ว

    PlayerPrefs does work but it has very limited saving capacity for full games. I recommend looking into do not destroy functionality and save data through scriptable objects and libraries. but for a quick result for a small game absolutely - go nuts with this method.

    • @SpeedTutor
      @SpeedTutor  3 ปีที่แล้ว

      This is why I only use it as a simple solution to a simple problem but thanks for your input! :)

  • @bhalwalx2
    @bhalwalx2 2 ปีที่แล้ว +1

    very helpful. Thanks

    • @SpeedTutor
      @SpeedTutor  2 ปีที่แล้ว

      That's no worries at all! Thanks for watching. :)

  • @cutesnitch1156
    @cutesnitch1156 3 ปีที่แล้ว +1

    How exactly do I incorporate this into the Main Menu you provide via your patreon?

  • @percyrogers7246
    @percyrogers7246 ปีที่แล้ว +1

    would you say i could use this for lets say the player has health on him, weapons, a upgrade ui that had 1 skill point spent , and a store where he can upgrade his weapons. would it save all that?

    • @SpeedTutor
      @SpeedTutor  ปีที่แล้ว +1

      I wouldn't say that is recommended because Player prefs isn't very quick and not very secure either. Anyone could find the data and edit it. It would be better using a different solution, like EasySave for instance :)

    • @percyrogers7246
      @percyrogers7246 ปีที่แล้ว +1

      @@SpeedTutor thank you will check in to that one.

  • @CaptCanada45
    @CaptCanada45 3 ปีที่แล้ว +4

    Great video as usual. Could you do a tutorial on how to create a menu where you can change a games graphics options?

    • @SpeedTutor
      @SpeedTutor  3 ปีที่แล้ว +2

      I do have my free menu system which has these features! But I will be doing this! :)

    • @UnityGameDev
      @UnityGameDev 3 ปีที่แล้ว

      @@SpeedTutor Sounds good. I was also thinking for the option to turn post processing on and off but the main menu will be in a different scene from the main game do you have any suggestions.

    • @DayMoniakkEdits
      @DayMoniakkEdits 3 ปีที่แล้ว

      Just make a persistent empty gameobject with the fonction DontDestroyOnLoad(your object) and find this object by the name of the script to check if the post processing needs to be on or off

  • @stuffedmannequin
    @stuffedmannequin ปีที่แล้ว

    I know this video is two and a half years old, but how would you be able to load an additive scene?

  • @torontogamestudio2991
    @torontogamestudio2991 ปีที่แล้ว +1

    Is there a way to save inventory too using this same method?

    • @SpeedTutor
      @SpeedTutor  ปีที่แล้ว +1

      I wouldn't recommend saving your inventory with playerprefs unless it's a very small amount of content. Better to have a specific save system for that. :)

  • @BenGodot
    @BenGodot ปีที่แล้ว +1

    Can you implement this into your main menu asset?

    • @SpeedTutor
      @SpeedTutor  ปีที่แล้ว

      It's already part of my main menu asset :)

  • @galla_yt
    @galla_yt 3 ปีที่แล้ว

    Gonna try this out with checkpoints instead of loading a game

    • @SpeedTutor
      @SpeedTutor  3 ปีที่แล้ว

      Good to hear it! :)

  • @FreeziK
    @FreeziK 3 ปีที่แล้ว +1

    Great thnx

    • @SpeedTutor
      @SpeedTutor  3 ปีที่แล้ว

      You're very welcome! :)

  • @UnityGameDev
    @UnityGameDev 3 ปีที่แล้ว +1

    I'm working on a main menu system and i wanted to make the player be on game screen. And when the mouse is dragged it pan around him. Could you pls do a tutorial on that.

    • @SpeedTutor
      @SpeedTutor  3 ปีที่แล้ว +1

      You could do that by just placing the player in the background and have your mouse control camera rotation around the object. Make sure your camera is using "LookAt" on the character.

    • @UnityGameDev
      @UnityGameDev 3 ปีที่แล้ว +1

      @@SpeedTutor So I could use the "if (Input.GetMouseButtonDown(0))" method and have it set active the script for the rotation and : "else if (Input.GetMouseButtonUp(0))" method to turn it back off.

    • @UnityGameDev
      @UnityGameDev 3 ปีที่แล้ว +1

      @@SpeedTutor Followed your advice and it worked perfectly

    • @SpeedTutor
      @SpeedTutor  3 ปีที่แล้ว +1

      Fantastic news! :)

    • @UnityGameDev
      @UnityGameDev 3 ปีที่แล้ว

      @@SpeedTutor th-cam.com/video/YDT3d4Mj384/w-d-xo.html

  • @457Deniz457
    @457Deniz457 3 ปีที่แล้ว

    Nice thanks ! :)

    • @SpeedTutor
      @SpeedTutor  3 ปีที่แล้ว +1

      Thanks for checking it out, Ray! :)

    • @457Deniz457
      @457Deniz457 3 ปีที่แล้ว +1

      @@SpeedTutor Thanks for keep uploading nice stuff and do good things for this world :)

  • @raman5352
    @raman5352 3 หลายเดือนก่อน

    It work for moltiple scene or just one

    • @SpeedTutor
      @SpeedTutor  3 หลายเดือนก่อน

      What do you mean?

  • @Legacyoftheardor
    @Legacyoftheardor 2 ปีที่แล้ว

    does this also save the actions you have done in the scene? like destroying the cube?

    • @SpeedTutor
      @SpeedTutor  2 ปีที่แล้ว +1

      Only if you choose to save that yourself. :)

    • @Btkaroakes
      @Btkaroakes ปีที่แล้ว

      @@SpeedTutor How do you do that?

  • @kazru7703
    @kazru7703 3 ปีที่แล้ว

    Hello,Sir. my game has inventory items and player profile data need to store,would you recommand using PlayerPref to save the these kind of data?

    • @SpeedTutor
      @SpeedTutor  3 ปีที่แล้ว

      I wouldn't advise saving lots of data into player prefs (Not saying you can't) but it isn't always efficient. I'd recommend one of the saving systems on the Unity store if you're serious about it! :)

    • @kazru7703
      @kazru7703 3 ปีที่แล้ว

      @@SpeedTutor Thanks for reply! And because I am pretty new to Unity (learn about half year),I have research on youtube for hours,and found a lot of ways to create a saving system,but still don't know how to do it correctly. For now I may try to use Json to save my data, or like you said , use one of the saving systems that's already been create on asset store.

  • @Btkaroakes
    @Btkaroakes 2 ปีที่แล้ว

    How do you make this work for me it is not saving?

    • @SpeedTutor
      @SpeedTutor  2 ปีที่แล้ว +1

      Do you have any errors?

    • @Btkaroakes
      @Btkaroakes 2 ปีที่แล้ว

      @@SpeedTutor No I fixed it I wrote one letter small case that's why it was not working. Thanks!

    • @Btkaroakes
      @Btkaroakes ปีที่แล้ว

      @@SpeedTutor I tried this today and it is not working?

    • @Btkaroakes
      @Btkaroakes ปีที่แล้ว

      Now It worked!

  • @wearwolf4202
    @wearwolf4202 2 ปีที่แล้ว

    How would you do this with the character Controller script? More specifically cause when I load in the old level my character loads at 000 or just not where it was saved. I'd like your help cause I'm having a hell of a time fixing it

    • @SpeedTutor
      @SpeedTutor  2 ปีที่แล้ว

      Are you save the exact position of the controller and then transforming it at the start?

    • @wearwolf4202
      @wearwolf4202 2 ปีที่แล้ว

      Yes I believe so, the problem is the position gets saved but because characterController has its own way of player position it just defaults to 0 0 0 in world space when I call playerprefs.getint.. when I first start up the game from no saved data I load in the player prefab and then place him at start position in a start function. When I go into a level and beat it I start at that same start position when I want to start at the level entrance but I just go back to start position. When I use playerprefs it gives me weird results like spawning at 0 0 0 or at best player position. I'd be willing to send you the project so you can look at it yourself but you'd have to let me know this issue has been a thing for 5 months now and idk what to do to fix it anymore.
      Thank you for your reply

    • @wearwolf4202
      @wearwolf4202 2 ปีที่แล้ว

      @@SpeedTutor sorry I don't know how to look at comments to me so I just saw this.

  • @TheBlackbirdii
    @TheBlackbirdii 3 ปีที่แล้ว

    can you make tutorial about rumble feedback /vibration please :(

    • @SpeedTutor
      @SpeedTutor  3 ปีที่แล้ว +1

      I'll see what I can do! :)

    • @TheBlackbirdii
      @TheBlackbirdii 3 ปีที่แล้ว +1

      @@SpeedTutor thank you very much !

  • @roshanthapa1297
    @roshanthapa1297 3 ปีที่แล้ว

    Good job. Can we get video on the saving data using json file and within unity binay file one. Hoping to see soon

  • @gmangman123
    @gmangman123 ปีที่แล้ว +1

    SpeedTutor == Get.Getcompanent