Announcement

Collapse
No announcement yet.

Save Data Through Widget Blueprint?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Save Data Through Widget Blueprint?

    I just recently setup a save game system with blueprints. At first I set it up in my third person character and binded it to keys for saving and loading. I want to change it over so they can save and load through the pause menu. I have my pause widget setup already. I basically just copied and pasted my BP setup from my third person character to my pause menu widget and made it so it saves and loads on the click of a button instead of keys. However it's not saving nor loading. As you can see from the following screenshots, I have a print string in my save game setup at the end. It prints the string "SAVE COMPLETE" but, it doesn't save any data. Any help would be greatly appreciated!

    Save Game Setup:

    Click image for larger version

Name:	Save1.PNG
Views:	3
Size:	130.2 KB
ID:	1185107

    Click image for larger version

Name:	Save2.PNG
Views:	3
Size:	151.8 KB
ID:	1185108

    Load Game Setup:

    Click image for larger version

Name:	Load1.PNG
Views:	3
Size:	128.0 KB
ID:	1185109

    Click image for larger version

Name:	Load2.PNG
Views:	3
Size:	190.2 KB
ID:	1185110

    Error Log:

    Click image for larger version

Name:	Error Log.PNG
Views:	2
Size:	51.0 KB
ID:	1185111

    #2
    Move the actual saving and loading to another actor/object. Perhaps the gamemode or gameinstance? Have the button call the events to handle these saves, but don't implement saving/loading in UMG.
    They broke the signatures so I removed mine thinking it'd be awhile. The signatures work again, but I haven't redone my signature yet.

    Comment


      #3
      The error indicates that the Char reference is null; you didn't set it.

      Either way I would recommend going a different route. Create another instance for your saving so that you can access it from multiple blueprints. This way you can eliminate rewriting code across several blueprints if you need to change something.

      Unpopular Minion on the Play Store (Released: January 31, 2016)

      Comment


        #4
        As others have said you should put the save in a different section and access that through UMG, but I'll tell you off the bat that your method won't work - you're creating a new save game every time the save button is clicked and loading that. So you'll never load any data.

        You need to do Check if Save File Exists, if it does, Load from Save File, if not, Create Save File.

        Comment


          #5
          Thank you everyone that has replied to the post. From my understanding, I have done it right. However, it's still not working. I put my save game and load game into functions in my third person character and called them in the widget blueprint. Is that how it is done? Here is my widget bp setup.

          Click image for larger version

Name:	WidgetBP.PNG
Views:	2
Size:	165.3 KB
ID:	1107312

          Thanks!

          Comment


            #6
            Anyone ?

            Comment


              #7
              try to delete old save file
              Igor, swamper, sole proprietorship

              Comment


                #8
                I would recommend to NOT make the savegame functions in your character. You will want your savegame mechanics to be available globally.

                Here's a good tutorial in the documentation - start easy saving a single variable (Maybe health) and continue from that. Afterwards make a list of what variables you need to save and load. Basically you save just variables like "character position" "current health" and so on.

                https://docs.unrealengine.com/latest...nts/index.html
                My Patreon page (UE4 goodies!)

                Comment

                Working...
                X