HTF do I? Use the SaveGame Object in Unreal Engine 4

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 มิ.ย. 2024
  • How do I use the Save Game Object in Unreal Engine 4?
    Source Files: github.com/MWadstein/wtf-hdi-...

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

  • @davidrichards3240
    @davidrichards3240 8 ปีที่แล้ว +36

    This is the best tutorial on this I've seen yet. Works great in my project, thanks a lot!

  • @jamesmakesgames1784
    @jamesmakesgames1784 7 ปีที่แล้ว +9

    Based on this one video i liked and subscribed to your channel.
    short, focused, to the point, no rambling, no live debugging, somebody prepared before they started recording...
    Excellent job!
    Keep em coming please!

  • @sezerburkas
    @sezerburkas 2 วันที่ผ่านมา

    Thanks, after 8 years still very useful

  • @FPChris
    @FPChris 7 หลายเดือนก่อน +1

    Thanks 8 years later it's still useful info.

  • @angryookami
    @angryookami 6 ปีที่แล้ว +5

    I love all your videos. You always go straight to the point. Very Clear. Thanks!

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

    THANK YOU!! This finally solved my problem and you saved me time. So here are some skeleton jokes:
    Who is the most famous skeleton detective? Sherlock Bones.
    What was the skeleton's favorite musical instrument? The trom-bone.
    What do you call a skeleton who won't work? Lazy bones.
    What song do skeleton bikers ride to? Bone to be wild.
    What do skeletons say as they head out to sea? Bone voyage!
    How did skeletons send mail in the old days? The bony express!
    What did the skeleton say to the vampire? You suck.
    Who is the most famous French skeleton? Napoleon bone-apart.
    How did the skeleton know it was going to rain? It could feel it in it's bones.
    What song do skeleton crooks listen to after a heist? Bad to the Bone.
    What do skeletons order at restaurants? Spare ribs!
    What was the skeletons favorite rock band? The Grateful Dead.
    Why are skeletons so calm? Because nothing gets under their skin.
    What kind of plate do skeletons eat on? Bone china.
    Why didn't the skeleton go to the scary movie? He didn't have the guts!
    What type of art do skeletons like? Skulltures!
    Why did the skeleton have to goto church to play music? They don't have any organs!
    Why did the skeleton go to the dance? To see the boogie man.
    How do skeletons say hello? Bonejour.
    What do old skeletons complain about? Aching bones.
    What do you call a skeleton who uses a door bell? A dead ringer.
    Why do skeletons hate the winter? Because the cold goes right through them.
    Why didn't the skeleton eat spicy food? He didn't have the stomach for it.
    What do boney people use to get into their homes? Skeleton keys!
    Who won the skeleton beauty contest? No body.
    Why did the skeleton cross the road? To get to the body shop.
    Why do skeletons like to drink milk? Because milk is so good for the bones!
    Why did the skeleton pupil stay late at school? He was boning up for his exams!
    Why did the skeleton run up the tree? A dog wanted to eat it's bones.
    Why don't skeletons like parties? Because they have no body to dance with.
    What does a skeleton use to call his friends? A tele-bone.
    When does a skeleton laugh? When something tickles his funny bone.
    What do you call a skeleton who went out in the snow? A numbskull!
    What's a skeleton's favorite type of plant? A bone-zai tree!
    What do you call a skeleton with no friends? Bone-ly!

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

    Thanks, I was stuck on this for whatever reason. You're very clear and I got what I needed in no time. Keep it up :)

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

    This video has not shown what I was looking for, but gave me the necessary impulse to get to my Goal. Many thanks!

    • @stakler2
      @stakler2 5 ปีที่แล้ว

      What was you looking for?

  • @Kai-pu2gh
    @Kai-pu2gh 6 ปีที่แล้ว

    You are so good! I search the internet for hours and in the end I find one of your videos and it all just clicks very nicley. Thank you

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

    Thanks Mathew! I am now the master of saving and loading :) Great video and very helpful indeed!

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

    Your videos helps me creating my own workaround. Ur a magician!

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

    This was exactly what I was looking for, thank you very much for your tutorial!

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

    dude your tutorials are awesome, keep it up

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

    Very glad I kept watching to the end even though you'd covered my question. I was going to do a much sloppier load/create method.

  • @user-yr6rt1mw9g
    @user-yr6rt1mw9g 2 ปีที่แล้ว

    Very straightforward tutorial, thanks a million times. It really saved my life (after days of searching). THANK YOU SO MUCH!!!!

  • @LiquidJ0Y
    @LiquidJ0Y 8 ปีที่แล้ว

    Your tutorials are always relay great thanx

  • @arcanechicken4342
    @arcanechicken4342 5 ปีที่แล้ว

    oh my god i love you this took so many tutorials to find

  • @mrmedbedb1256
    @mrmedbedb1256 4 ปีที่แล้ว

    Your tutorials are very good!
    You give it in a easy, clear way. And your language is legible for me ( I'm russian).
    THANKS!!! )))

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

    nice tutorial, very easy to understand

  • @codeman0018
    @codeman0018 8 ปีที่แล้ว +7

    A GREAT MAN YOU ARE

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

    NOTE: It isn't explicitly demoed in the video but your saves persist when closing and opening the editor.

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

    Good stuff Matt, thanks a lot

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

    Thanks you've been crystal clear, would you suggest this method to store a "pokemon-like" savegame? Like all captured monsters, current team, items, etc? I'm trying to understand what's the best way and if this is gonna work server side

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

    I love this series.

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

    Thank you for the great tutorial!!!

  • @jakedubs
    @jakedubs 8 ปีที่แล้ว

    THANK YOU SOOOO MUCH. This is the clearest tutorial ever made in UE4. everyone else made it so complex. thank you thank you

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

      Awesome to hear it helped out =)

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

      The Same Game Object would just be to save it between states. For example when the player quits then comes back so yes it would be appropriate for a high score. For just displaying the screen the HUD you would look into just using UMG and a Text Block to display it.

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

      You would have to load the save game object when you start up your game and then anything there is a new high score you would have to update your save game object and save it again. The code to update it is all up to you the object does not do anything automatic it just holds the data you want it to hold.

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

      To add it to the HUD you should look at UMG and Text Blocks. The official UE4 videos cover how to do a basic UI like this and the FPS series on this channel covers how to keep track of a score and update it on the screen.

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

      If you want the scores to save between games you would need to save and load the save game object. If you just want scores to be shown on the screen you don't need the save game object at all.

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

    Great vid! Thanks

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

    Just a question on best practice: If you rename or move the SaveGame Object in the Content Browser, this will break all Sav files associated with it as it no longer seems to be able to cast the loaded save game to the custom SaveGame type that it was saved as. What is the best way to deal with this? Do you just create a SaveGame Object and make sure NEVER to move or rename it ever again lest you break compatibility with old .Sav files? Or is there a better way of going about this?

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

    Are only the default variable types (integer, string, etc.) supported? Because I tried to save an Array of objects of a blueprint which contains my variables like health, and it didnt work.

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

    Interesting. I'm using version 4.25.3 and my Cast to MySaveGame tells me it's already cast, and I can pull pull a health var from it. Still an excellent video. Thank you.
    Also it saves under Unreal Projects\GameLoadSave\Saved\SaveGames in some un-editable format.

  • @mr.unreal9662
    @mr.unreal9662 6 ปีที่แล้ว +1

    How do you do it so that When you press the button different thing happen if the number is different.

  • @RevenaSurniak
    @RevenaSurniak 5 ปีที่แล้ว

    So I'm doing something that needs to get the original last saved value, edit it, then save it. How can I do this? Do I ( Load > Set > Save) or (Set > Save) I'm unsure.

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

    Thank you, sir! :)

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

    I Love you man!!

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

    I#m confused: In a widget class is the functionality of a saved object and not in the save object himself? Is this object oriented programming?

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

    Perfect!

  • @WilliansBenites
    @WilliansBenites 5 ปีที่แล้ว

    hello friend a query
    a system of saved as well as resident evil .. that in each level there is a typewriter to keep the progress of the game you know how to do that?

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

    Has the [Cast To MySaveGame] step at 2:40 become redundant in current versions of UE4? When I follow those steps and compile, the cast node has a note that reads. "Info 'Return Value' is already a 'My Save Game', you don't need to cast to MySaveGame'"

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

      Yep I believe as of 4.15 they finally fixed this so it automatically outputs the correct type now. I will add a note on the video above with this =)

  • @TongucBodur
    @TongucBodur 5 ปีที่แล้ว

    Does this way of saving variables also support saving structs?

  • @bencrane2940
    @bencrane2940 8 ปีที่แล้ว

    First i wanna say that your Tutorials are the best and straight to the point. I've learned a lot just from your Vid's. but i ran into a snag with the save game tut. all my strings are saying everything is working from saving to loading but for some reason every time i press my Retry button which is my Reload Level Button my best score is set back to Zero even tho it says it saved and loaded correctly? i am using a TextRender to show the score. I dont know if that makes a difference?

    • @MathewWadsteinTutorials
      @MathewWadsteinTutorials  8 ปีที่แล้ว

      +Ben Crane It is possible the TextRender is causing an issue I know they get buggy sometimes and don't change text properly. You can always try printing out the string before the text render to double check to see if that is the issue. It is possible your Text Render got bugged and if so just delete it and make a new one and it *should* fix it.
      If the Print String is showing the 0 then just check to make sure the save game name is the same for loading and saving.

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

    Do you have video on user index?`

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

    I have weird issue, I can save only 1 variable, other variables back to default value

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

    I know this is an older video, but I can't find the answer to this anywhere: is it possible to save an instantiated object to a file? As in, can I save a specific instance of an object to a save game object, or can it only take simple variables? Thanks!

    • @MathewWadsteinTutorials
      @MathewWadsteinTutorials  6 ปีที่แล้ว

      If you were to create something that would save the specific instance to file then yes you could do that but it would basically be a wrapper for what you are describing here by saving out the simple variables. For the most part without any extra work you don't save out the things that never change on your object. Saving out the actual mesh that is on the object would be a waste of space when you could just save out the reference/name of the mesh you are using. This would be the same for all of the settings on the object.
      Basically yes you would just save out the simple variables and then recreate the item when you want to load it back in.

    • @travislee5618
      @travislee5618 6 ปีที่แล้ว

      Yes, this is what I have been doing, just creating specific save game objects and then creating functions inside what needs to be saved to handle saving what is important to the object. Thank you for the reply :)

  • @byLovebird1
    @byLovebird1 4 ปีที่แล้ว

    What if you have a bigger game and you need to save a lot of things, is there another way or do I need to create a lot of variables in the SaveGame Blueprint?

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

      Did you find an answer? I want a List actor that has all the variables that I want saved from multiple blueprints. E.g.:
      Health < saved from Character BP
      Time < saved from Level BP
      Gun type < saved from Locker BP
      Then I want my Save BP to load this list, grab all the variables from the correct BPs, and then save a copy of these names (as variables) in the Save BP - so that I dont need to manually make / type the names for double variables of everything.
      Very annoying that UE did not do this for us, like they have the checkbox on variables for Instance Editable... should have a check for "save variable for Save slot actor?" Then I only have to mess with a variable once in a BP, instead of manually going back to remember all the vars I want saved in a Save slot.

  • @Hasan-gh9gv
    @Hasan-gh9gv 7 ปีที่แล้ว +2

    I want to save and load value of checkbox. What should I do ? I need help.
    Whenever I restart game Checkbox value become default.

    • @MathewWadsteinTutorials
      @MathewWadsteinTutorials  7 ปีที่แล้ว +4

      That should not be too hard to do. The Save Game Object just holds stuff you want to save so you would have a boolean variable in it that you would use to track the checked state of the checkbox. When you save the game you check the Checkbox, update the save game object with the new state, and save the save game object. You would do the opposite when you load by loading the Save Game object, getting the value you saved in it for the checkbox, then telling the checkbox what it should be.

    • @Hasan-gh9gv
      @Hasan-gh9gv 7 ปีที่แล้ว

      Thank you so much

  • @cosmotect
    @cosmotect 4 ปีที่แล้ว

    Awesome

  • @tombstonestudios5963
    @tombstonestudios5963 5 ปีที่แล้ว

    can i delete the savegame with blueprints ?

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

    I have multiple collectibles, how can I use an array to keep track of which ones were picked up?

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

      Did you find an answer?

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

      @@kenalpha3 I used this guy's video. This way the items I picked up are not respawned when a saved game is restarted. th-cam.com/video/1JNoP9u99ZA/w-d-xo.html

  • @JohnDaniels
    @JohnDaniels 6 ปีที่แล้ว

    Nice video, is there a way in blueprint to copy and rename a "SaveGame" file?

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

      Nothing for just that. You can open the save game file then save it to a new slot name to "rename" it then you have the choice of deleting the old one.

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

      Thank you, that worked perfect!

  • @bencrane2940
    @bencrane2940 8 ปีที่แล้ว

    yea it's showing that the TextRender is not changing.. Any Ideas?

    • @MathewWadsteinTutorials
      @MathewWadsteinTutorials  8 ปีที่แล้ว

      +Ben Crane If the print string is correct but the Text Render is not updating properly try deleting it and making a new one. It is a know issue posted here answers.unrealengine.com/questions/305084/the-text-render-component-is-not-updating-on-the-v.html

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

    The "Set:LocalGameInstance" that is created at 8:55 seems redundant. It seems to me that the execute pin could just be drawn to the first one. Maybe it makes no difference at compile time (I don't know how the compiler optimizes code in UE4) but I try to use as few nodes as possible. No point in duplicating code if there's no need to.

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

      You can't plug multiple values into one Set node, if done as you described the execution pin would trigger the first Set LocalGameInstance, but the value would only be plugged into the first cast, so it would try to set it to the value from the failed cast, resulting in nothing being set and returning an error

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

      @@Mikester4411 Right you are. Thanks

  • @nekrosprime1553
    @nekrosprime1553 5 ปีที่แล้ว

    How would I save the visibility of an image

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

      Use an ESlateVisibility Enum variable, and when you load it you can set the image's visibility to that.

  • @chrisbushell3714
    @chrisbushell3714 5 ปีที่แล้ว

    I know this video is super old, but still very informative. Even in 4.19 (4.20 is out though), however, I am trying to get my game to have different materials for my character. I have a Widget in my main menu that lets me set the material for the character, but I cannot get it to follow to different levels. I have tried creating the save game, tried working it in my Game Mode, and a couple other things, but I cannot seem to find the solution. I have been at it for weeks.
    If anyone can help or has a solution that would be awesome!

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

      Did you find out? As far as I know, you just need to save the material as a variable in your save game actor ("S Material" > saved in your Save BP).
      But this variable name will be a double/copy name of your real variable ("Material" > saved in your Character BP or Widget or wherever your code is that sets the original material change).
      Then in your Save BP, you Cast to Character BP > get Material (variable) > set it to "S Material" (variable in your Save BP) >> then save that new value in your Save BP.
      But this is the part Im still trying to find out if there is a better way (than having 2 sets of names of the same variable type). I want to make a List actor that has all the variables that I want saved from multiple blueprints. E.g.
      Health < saved from Character BP
      Time < saved from Level BP
      Gun type < saved from Locker BP
      Then I want my Save BP to load this list, grab all the variables from the correct BPs, and then save a copy of these names (as variables) in the Save BP - so that I dont need to manually make / type the names for double variables of everything. Very annoying that UE did not do this for us, like they have the checkbox on variables for Instance Editable... should have a check for "save variable for Save slot actor?" Then I only have to mess with a variable once, instead of manually going back to remember all the vars I want saved in a Save slot.

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

    what about booleans? Everyone also skips how to save booleans.

  • @FerintoshFarmsPhotography
    @FerintoshFarmsPhotography 4 ปีที่แล้ว

    I don't know why I always was so scared of saving.

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

    Lol, why in official tutorial about saving and loading no anformation about that you dont need to use "Create Save Game Object" if you have save game object exist ... Thanks for tutorial :)

  • @phosphornaut6811
    @phosphornaut6811 4 ปีที่แล้ว

    What about Bob?

  • @PizzoLab
    @PizzoLab 4 ปีที่แล้ว

    The cast isn't necessary. Anyway, a nice video for the rest! 😉

  • @stakler2
    @stakler2 5 ปีที่แล้ว

    so easy

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

    ugh, so many nodes for such a trivial task...when will regular old scripting be available again???? "Anyone that responds use C++| or |nodes are just as good" C++ is overkill for such simple methods, and scripting is by far smaller and faster to work with. I know everyone has their own opinions, but please don't throw those two arguments at me..been doing this since 2005 so..there is nearly nothing new you can say to me I haven't already heard.