x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to connect Game Instance data to Save game.

I know how bought of these work. What I don't know how do they communicate to each other. How do you pull Game Instance data and feed it in to Game Save. Would it do with Cast to Game Instance and connected to Cast to Game Save in that kinda order?? Thank you.

Product Version: UE 4.15
Tags:
more ▼

asked Aug 18 '18 at 06:39 AM in Using UE4

avatar image

silverfish1000
124 12 23 29

avatar image silverfish1000 Aug 18 '18 at 10:07 PM

Ok these brings me to another question. Since I have Game instance all working and is showing me proper score and all. I would like to then take that Text Block (0) or what ever the score it is and save it to my game save. I just don't know how to cast to text block and all the nodes that come off it. I can make Text variable inside the Text graph but I don't know how to use them together with Game Save. In short wouldn't be Ok if I save the text information and then load back from Game save and display it with High Score text? I'm not supper advance with all these so I really need simple explanation. Sorry and Thank you again!!!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Would it do with Cast to Game Instance and connected to Cast to Game Save in that kinda order?

Yes.

But wouldn't it be easier to have the SaveGame object IN the GameInstance. Would save you a lot of running forth and back... Besides, GameInstance is globally available, easy to access and, most importantly, persistent.

more ▼

answered Aug 18 '18 at 08:03 AM

avatar image

Everynone
15.2k 77 25 62

avatar image silverfish1000 Aug 18 '18 at 01:37 PM

Thank you for reply!!!! You been a life saver!!

So How would I put Save Game object in the Game Instance?? Could you please Guide me trough the sleepless nights. So I can return to normal life. Thank you!!!

[1]: /storage/temp/250852-save-game.png

save-game.png (171.6 kB)
avatar image Everynone Aug 18 '18 at 09:47 PM

There's more than 1 way of doing this. See if this method suits you:

SaveGameObject has a custom event that takes data you want to save:

alt text

GameInstance has 2 functions - Save & Load

alt text

alt text


So you can do this anywhere in the game:

alt text

Do use the same slot name, otherwise it's not going to work well, obviously.

savegameobject.png (37.1 kB)
gi-save.png (303.0 kB)
gi-load.png (220.8 kB)
anywhere.png (191.7 kB)
avatar image silverfish1000 Aug 18 '18 at 09:51 PM

Jesus I didn't even see the reply and been looking for answer on the net all day. THANK YOU, THANK YOU. Thank you for VISUAL and you time!!!! Let me please dig in to these and please stay with me cause I'm about to throw my PC out the window. lol. I'll let you know if I managed to hook it up correctly!! Thank you again!!!

avatar image Everynone Aug 18 '18 at 09:52 PM

Sure thing. Just hammer at it until it works :)

I tested this very briefly, seems to save stuff.

avatar image silverfish1000 Aug 18 '18 at 10:15 PM

Also let me explain my project. It has only one level an main menu level. The points collector is trigger box that's been cast to game instance with integer + integer. The in game score text and the main menu high score text all get information from Game Instance which all works grate until I close the game in editor. Than all is back to 0.

avatar image Everynone Aug 18 '18 at 10:17 PM

I tested the script I posted briefly but after running the Save function once, next time you launch and run just Load, it read the data correctly.

avatar image silverfish1000 Aug 18 '18 at 10:22 PM

Thank you for reply. I'm just not sure I understand the get text variable because the text I'm referring to is Text Block (Score) I need to hand over these Score text information to Game Save some how. For give me if I'm not connecting to what your already explain to me. I'm slow that way. Thank you!!!

avatar image Everynone Aug 18 '18 at 10:25 PM

In pic 1 then:

  • create a text variable in the game object

  • add text variable input to the custom event in the save game input

  • add text variable to the save game function

In your widget:

  • get text block > get text

  • run Save from the 2nd pic


edit: I mean, my example actually saves text. So you can use it as is with the widget. No need to change anything, actually.

avatar image silverfish1000 Aug 18 '18 at 10:46 PM

Sorry these is to complicated for me. I'm already lost at the second point. Do I need to connect second point you mention to my trigger box? Where exactly does text variable input and custom event and save game input all all connect? Would they go in to the BP or my Trigger box overlap?? Sorry I'm really that basic. Thank you.!!!

avatar image Everynone Aug 18 '18 at 10:51 PM

Do I need to connect second point you mention to my trigger box?

When you are ready to save data you just run this:

alt text

Connect it to a trigger box. The trigger box should now get access to the widget > get text block > get text and you plug that that text into the Text to Save pin above.

capture.png (59.3 kB)
avatar image silverfish1000 Aug 19 '18 at 03:11 AM

Sorry just got back. Thank you a million for the reply!!! For some reason I'm starting to see a light at the end of the tunnel. I manage to get some stuff going but I don't know how did you get Text to Save pin. I just got Save Data so far no Text to Save. Here are the pic. Sorry I know your about to kill me any minute now. Just please work with me on these one I know I can get it to work with your help! For some reason text block 334 dosen't wana connect to my Save Data. What am I missing?? Thank you!!

alt text

avatar image Nebula Games Inc Aug 19 '18 at 03:20 AM

When you create a custom event "Save This", you can click on the red event node and add an "input" on the right hand details panel. He called this input "Text To Save" and made the type a String variable. "Text Block 334" is a widget text block variable, that would not be a variable from a Save Game Object. You need a widget reference for that variable to make any sense.

avatar image silverfish1000 Aug 19 '18 at 03:27 AM

How do I get widget reference. That's sort of what I been looking for I think. Thank you guys. !!

avatar image silverfish1000 Aug 19 '18 at 03:40 AM

Yes exactly! What I need is a text block reference to then save it with Game Save. How would I get that text block 334 reference. So what ever the current score is inside that text that would be the score I would like to save let's say when I exit the game and go to main menu. Could you please show me in a visual way. Just the text reference. Thank you a 3 million.

avatar image silverfish1000 Aug 19 '18 at 03:52 AM

alt text Could these tut be correct. Can these actually work??

text-to-save.jpg (245.8 kB)
avatar image Nebula Games Inc Aug 19 '18 at 04:08 PM

Depends where you create the widget. Is it a viewport widget? A widget component on an actor etc This will determine how you go about getting a reference to the widget variables.

avatar image Everynone Aug 19 '18 at 04:23 PM

Did you just make a YT tutorial about this?! o_O

avatar image Nebula Games Inc Aug 19 '18 at 06:30 PM

haha I have like 40+ YouTube tutorial videos, I have one for save/load game, widgets, beginner stuff, random things etc But no, I didn't just make one for this or I would have posted a link here :P

avatar image Everynone Aug 19 '18 at 06:32 PM

Aksing because I subscribe and I thought something about function inputs popped up for me.

avatar image Nebula Games Inc Aug 19 '18 at 06:42 PM

Ah, well I have one up for that but I don't think it is the functions tutorial, in a few weeks I will have a save/load for my beginner series up but it is not out yet. Also, thanks for the support!

avatar image silverfish1000 Aug 21 '18 at 04:53 AM

What was I looking for it's explaind in Easy Save N load. Mamonium Vid . Saving Score in to Game Save. Game Instance did't count in his video and I think that was the problem right of the bat. Thank's guys. Was just confusing you with my own confusion. lol. Sorry.

avatar image silverfish1000 Aug 19 '18 at 05:40 PM

Thank you guys!! Newer mind the upstairs picture!

So I got Main Menu Widget and L1 widget and that's really all. .

1LV kinda game. In these LV there is a trigger box that's collecting points that go in to Game Instance.

Main menu widget has HIGH SCORE Text and LV1 has a SCORE text...

When going back to Main Menu the High Score data is taken from Game instance and shows fine! .. . I tried changing Game Instance to Game Save but increment integer + integer dont work. . .

What's funny that on print string is showing what I put as a integer number (++) so If I put 5 it will keep printing 5 on every hit instead of increasing like it does with game instance. . .

I need reference of some kind in my LV1 Widget to the Score text in my LV1 and have it Saved and then Loaded again on event begin in my Main Menu.

I guess I'm looking for my TEXT BLOCK 334 reference and some how have it saved in to my SaveSlot to be able to loaded on Event Begin play when I start the game. . .

How do you get reference to the Score text in my LV1?? You guys have been really patient. Thank you for your time!!

avatar image Everynone Aug 20 '18 at 10:14 AM

How do you get reference to the Score text in my LV1?? You guys have been really patient. Thank you for your time!!

Think about the object that was responsible for the creation of the widget that has the text. Where and what is that object? Where did you the use CreateWidget node?

avatar image silverfish1000 Aug 21 '18 at 04:49 AM

Thank you for reply! I Finally got it working. How ever still strange to me that incramenting the score dint work for Save Game object like it works for Game Instance. Cause the tutorial I found the Save Game int + int works fine. I know I did something wrong I just thought it would work====Create save game object=== cast to Save Game obj.=====get Score====int + int set Score====save to slot. But didn't work for me. Either way. Thank you for your patience and help. I'm glad it's working.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question